Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- with open("textos.txt") as source:
- fullText = source.read()
- match = re.findall("(\\.\d+.+?)(?=(\\.\d+|\Z))", fullText, re.DOTALL)
- for text in match:
- lines = text[0].split("\n")
- title = lines[0]
- content = "\n".join(lines[1:])
- with open(title + ".txt", "w") as output:
- output.write(title + "\n" + content)
Add Comment
Please, Sign In to add comment