Skip to content

Instantly share code, notes, and snippets.

@128f

128f/cutup.py Secret

Created March 29, 2023 23:44
Show Gist options
  • Save 128f/56869087fa935dd17b8f4ce36518f6d3 to your computer and use it in GitHub Desktop.
Save 128f/56869087fa935dd17b8f4ce36518f6d3 to your computer and use it in GitHub Desktop.
breaking a datafile up by a special delimiter
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