Created
April 23, 2022 03:06
-
-
Save Lubba-64/8e22a25fd1f34a19b2c1f7f287e0b321 to your computer and use it in GitHub Desktop.
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
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this was a one time use type of thing I decided to save here.