I am trying to create a list from a csv file. However, I'm having a tough time using the split method because some of the attributes in the csv file has comma's that are within parenthesis. for example:
csv file:
500,403,34,"hello there, this attribute has a comma in it",567
So for example, when I iterate through the file:
for line in f:
fields = line.split(",")
fields = ['500','403','34','"hello there','this attribute has a comma in it"','567']
How can I get it to look like this:
fields = ['500','403','34','"hello there, this attribute has a comma in it"','567']
I would like to use Regex for this, but if there is an easier way I'd love to hear it. Thanks!