blob: e3acad45b9e5f0475925e77e7d90e56d4ad042c5 (
plain)
1
2
3
4
5
6
7
8
9
|
import re
with open('/home/lxf/documents/textsnippets.txt', 'r') as f:
data = f.read()
snips = re.split("---", data)
for snip in snips:
# strip the blank line at the end
s = '\n'.join(snip.split('\n')[1:-1])
#make sure we output the newlines, but no strong wrapping single quotes
print(repr(s.strip()).strip('\''))
|