-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTogether into One - As it is.py
53 lines (37 loc) · 1.18 KB
/
Together into One - As it is.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
50
51
52
53
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('PDG-MassData.csv')
WidthDataBaseCSV = openCSV('PDG-Width-Data.csv')
IGJPCNameDataBaseCSV = openCSV('PDG-Name-IGJPC-Data.csv')
DataBaseCSV = []
for k in range(len(WidthDataBaseCSV)):
linkIDM = MassDataBaseCSV[k][0]
Ptype = MassDataBaseCSV[k][1]
mass = MassDataBaseCSV[k][2]
linkIDW = WidthDataBaseCSV[k][0]
linkIDIG = IGJPCNameDataBaseCSV[k][0]
if k == 0:
fullWidth = "Width"
else:
fullWidth = WidthDataBaseCSV[k][2]
IGJPCvalue = IGJPCNameDataBaseCSV[k][2]
Name = IGJPCNameDataBaseCSV[k][3]
# print("")
DataBaseCSV.append([linkIDM, Name, Ptype, mass, fullWidth, IGJPCvalue])
print([linkIDM, Name, Ptype, mass, fullWidth, IGJPCvalue])
if (linkIDM != linkIDW and linkIDW != linkIDIG):
print("\n\n\nError!!\n\n\n")
myFile = open('PDG-Data-ASitWas.csv', 'w')
with myFile:
writer = csv.writer(myFile)
writer.writerows(DataBaseCSV)
# print(DataBaseCSV)