"how to convert a string that has newline characters in it into a list in python? " Code Answer
4
you want your_str.splitlines(), or possibly just your_str.split('n')
using a for loop -- for instructional use only:
out = []
buff = []
for c in your_str:
if c == 'n':
out.append(''.join(buff))
buff = []
else:
buff.append(c)
else:
if buff:
out.append(''.join(buff))
print out
you want
your_str.splitlines()
, or possibly justyour_str.split('n')
using a for loop -- for instructional use only: