So as an example the data I'm using in a .csv file is
NA,ShimmyXD,#NA1,Radiant,135.8,992,24.9,0,140,80,161,"1,506","1,408",703,1.07,0.7,29,208.8,59,59.6,Fade,Viper,Omen,Vandal,35,59,5,802,Phantom,33,62,5,220,Classic,36,60,3,147
I'm currently trying to split it in python and removing all of the commas however when I use the split it turns "1,506" -> '"1', '506"' which I don't want I want it to split everything but keep it as 1,506 or 1506
Currently, this is how my code looks like is not final it's still a WIP
def ValorantDoL(file):
"""
Sorts data into Dictionary of List
"""
Data = {}
f = open(file, 'r', encoding='UTF-8') #encoding allows us to get everything in the file
headers = f.readline().strip().split(',')
Data[headers[0]] = []
for num, line in zip(range(len(headers)),f):
line = line.strip().split(',') #<-- Issue Here
print(line)
print("#---------------------#")
Data[headers[num]] = (line[num])
f.close()
return Data
When I run this it returns
['NA', 'ShimmyXD', '#NA1', 'Radiant', '135.8', '992', '24.9', '0', '140', '80', '161', '"1', '506"', '"1', '408"', '703', '1.07', '0.7', '29', '208.8', '59', '59.6', 'Fade', 'Viper', 'Omen', 'Vandal', '35', '59', '5', '802', 'Phantom', '33', '62', '5', '220', 'Classic', '36', '60', '3', '147']
Any idea what the problem is? I tried using replace function but that doesn't seem to work either.
I just want it to return this
['NA', 'ShimmyXD', '#NA1', 'Radiant', '135.8', '992', '24.9', '0', '140', '80', '161', '"1,506"', '"1,408"', '703', '1.07', '0.7', '29', '208.8', '59', '59.6', 'Fade', 'Viper', 'Omen', 'Vandal', '35', '59', '5', '802', 'Phantom', '33', '62', '5', '220', 'Classic', '36', '60', '3', '147']