-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsvthing.py
More file actions
39 lines (39 loc) · 1.13 KB
/
csvthing.py
File metadata and controls
39 lines (39 loc) · 1.13 KB
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
37
38
39
import csv, sys
filename = 'C:\\Users\\vadog\\Work\\Work\\SpanishWords\\jehle_verb_database.csv.txt'
biglist = []
with open(filename, newline='') as f:
reader = csv.reader(f)
try:
for row in reader:
biglist.append(row)
except csv.Error as e:
sys.exit('file {}, line {}: {}'.format(filename, reader.line_num, e))
biglist.pop(0)
data = []
for item in biglist[0:11466:18]:
x = str(item[7:11]+item[12].split(' '))
x = x.replace('[', '')
x = x.replace(']', '')
x = x.replace('\'', '')
data.append([item[0], item[1], x])
c = -1
for item in biglist[3:11466:18]:
c+=1
x = str(item[7:11]+item[12].split(' '))
x = x.replace('[', '')
x = x.replace(']', '')
x = x.replace('\'', '')
data[c].append(x)
c = -1
for item in biglist[2:11466:18]:
c+=1
x = str(item[7:11]+item[12].split(' '))
x = x.replace('[', '')
x = x.replace(']', '')
x = x.replace('\'', '')
data[c].append(x)
for item in range(len(data)):
f= open("C:\\Users\\vadog\\Work\\Work\\DataforSpanish\\"+data[item][0]+".txt","w")
for i in range(5):
f.write(data[item][i]+'\n')
f.close()