-
-
Save 128f/56869087fa935dd17b8f4ce36518f6d3 to your computer and use it in GitHub Desktop.
breaking a datafile up by a special delimiter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def readLines(): | |
with open('./7b.txt', 'r') as file: | |
content = file.read() | |
s = content.split("---------------") | |
return s | |
def writefiles(files): | |
count = 0 | |
for file in files: | |
count = count + 1 | |
if "reddit" in file or "nosleep" in file: | |
continue; | |
with open('./output/%s.txt'%(count), 'w') as outfile: | |
outfile.write(file.replace("\\n", "\n").replace('\\"', '\"')) | |
s = readLines() | |
writefiles(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment