reading a csv file and removing \n in Python
Question: I'm trying to read a csv file and put the elements in an array but the last
element of each row is being joined with the first element of the following
row with a \n in the middle. Here is the code:

    
    
    f = open("read_file.csv", "r+")
    lines = f.read().split(',')
    
    
    f.close()
    print lines
    
    exit()
    


Answer: You would want to use the csv module in the standard library

    
    
    import csv
    with open('read_file.csv', 'r+') as csvfile:
        lines = csv.reader(csvfile)
        for line in lines:
            # do your stuff here
    

