-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeautyCSVDnD.py
More file actions
28 lines (24 loc) · 815 Bytes
/
beautyCSVDnD.py
File metadata and controls
28 lines (24 loc) · 815 Bytes
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
#Grüße von Tim
import csv
import sys
import datetime
def process():
if len(sys.argv) < 2:
print("Fehlender Datei Parameter")
return
f = open(sys.argv[1]+"_s.csv", "w")
with open(sys.argv[1]) as csvfile:
reader = csv.reader(csvfile, delimiter=';')
for row in reader:
if len(row)==4:
if row[3]!="":
row.pop(0)
row.pop(0)
f.write(";".join(row)+"\n")
print("["+datetime.datetime.now().strftime("%H:%M:%S")+"] Zeile: "+str(reader.line_num))
else:
print("["+datetime.datetime.now().strftime("%H:%M:%S")+"] Zeile: "+str(reader.line_num)+" ist leer")
f.close()
print("#TimLoben")
if __name__ == '__main__':
process()