-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTogether into One.py
49 lines (33 loc) · 1.09 KB
/
Together into One.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
37
38
39
40
41
42
43
44
45
46
47
48
49
import BeautifulSoup
import re
import urllib2
import csv
def openCSV(filepath):
returnarray = []
with open(filepath) as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
returnarray.append(row)
return returnarray
MassDataBaseCSV = openCSV('PGD-Data-Mass-Float.csv')
WidthDataBaseCSV = openCSV('PGD-Data-Width-Float.csv')
IGJPCNameDataBaseCSV = openCSV('PDG-Name-IGJPC-Data.csv')
DataBaseCSV = []
for k in range(len(WidthDataBaseCSV)):
linkIDM = MassDataBaseCSV[k*2][0]
Ptype = MassDataBaseCSV[k*2][1]
mass = MassDataBaseCSV[k*2][2]
linkIDW = WidthDataBaseCSV[k][0]
linkIDIG = IGJPCNameDataBaseCSV[k][0]
fullWidth = WidthDataBaseCSV[k][2]
IGJPCvalue = IGJPCNameDataBaseCSV[k][2]
Name = IGJPCNameDataBaseCSV[k][3]
# print("")
DataBaseCSV.append([linkIDM, Name, Ptype, mass, fullWidth, IGJPCvalue])
if (linkIDM != linkIDW and linkIDW != linkIDIG):
print("\n\n\nError!!\n\n\n")
myFile = open('PDG-Data.csv', 'w')
with myFile:
writer = csv.writer(myFile)
writer.writerows(DataBaseCSV)
# print(DataBaseCSV)