Painting Blue Code
Simple, self-explanatory code snippets.
2017-06-14
Python - How to split a string into paragraphs
data = 'paragraph number one\n number two'
p = 0
for l in data.split('\n'):
p+=1
if l != '':
print p, '\t', l
PS. Assuming paragraphs are delineated by a carriage return (\n).
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment