Skip to content

Instantly share code, notes, and snippets.

@Lubba-64
Created April 23, 2022 03:06
Show Gist options
  • Save Lubba-64/8e22a25fd1f34a19b2c1f7f287e0b321 to your computer and use it in GitHub Desktop.
Save Lubba-64/8e22a25fd1f34a19b2c1f7f287e0b321 to your computer and use it in GitHub Desktop.
raw = ''
with open('raw.txt','rt') as f:
raw = f.read()
formatted = raw.split('\n')
import re
to_delete = []
for index in (range(len(formatted))):
if re.match(pattern='[ \n\t\r]',string=formatted[index]):
to_delete.append(index)
print(len(formatted),index)
to_delete.sort(reverse=True)
for item in to_delete:
del formatted[item]
for index in range(len(formatted)-1):
if '...' in formatted[index]:
formatted[index + 1] = f'\n{formatted[index + 1]}'
formatted[index] = formatted[index].split('...')[0]
with open('small_fmt.txt','wt') as f:
f.write(','.join(formatted))
@Lubba-64
Copy link
Author

this was a one time use type of thing I decided to save here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment