-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsheetanalyze.py
36 lines (32 loc) · 918 Bytes
/
sheetanalyze.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright (c) 2021 Azhaan Salam
# Licensed under the MIT License
from termcolor import colored
print(colored("sheet name: ", green), end="")
inp = input()
inp = input("sheet name: ")
file = []
has = 2
with open(f"sheets/{inp}.txt", "r") as f:
j = f.readlines()
for i in j:
for x in i.split():
for l in x:
if l == '[':
has = 1
break
x = x.strip("-")
if has == 2 and len(x) > 1:
x = ' - '.join(x[i:i + 1] for i in range(0, len(x), 1))
x = x.strip("[")
x = x.strip(']')
x = x.replace("|", "\n\n")
file.append(x)
has = 2
with open(f"sheets/{inp}.txt", "w") as f:
f.truncate(0)
with open(f"{inp}.txt", "a") as f:
for i in range(6):
f.write("\n")
for i in file:
f.write(i)
f.write(" ")