In python, removing thousands comma from numbers in a list where the numbers are separated by commas
Question: I have a list of data similar to that below:

    
    
    a = ['"105', '424"', '"102', '629"', '"104', '307"']
    

I want this data to be in a form similar to that of below:

    
    
    a = ['105424', '102629', '104307']
    

I am unsure of how to proceed. I thought perhaps removing all the commas then
inserting commas only where they should be and then removing the quotations. I
am finding this to be quite challenging.

Thanks


Answer: I'm assuming this data was originally in a csv file where data that contains
commas is quoted ("105,424","102,629","104,307") and then you are splitting on
comma:

    
    
    >>> '"105,424","102,629","104,307"'.split(',')
    ['"105', '424"', '"102', '629"', '"104', '307"']
    

Rather you should let the [`csv`](http://docs.python.org/library/csv.html)
module do the work as it will handle the double quotes:

    
    
    import csv
    
    with open('u:\\foobar.csv', 'rb') as f:
        reader = csv.reader(f)
        for row in reader:
            print [x.replace(',','') for x in row]
    

This prints: `['105424', '102629', '104307']`

