Revision history [back]

Actually, this is not related to ipython notebook but about Python, you can have a look at the csv module

To import csv:

sage: import csv


In your case, the delimiter is not a coma, but a sequence of spaces, so you have to tell csv that the delimiter is a space (you can only use a single character for the delimiter), and that the other spaces should be skipped.

Now, you can load your csv file and loop to each of its rows, and each row will be a list of columns:

sage: with open('/tmp/plop.csv', 'rb') as my_file:
....:    reader = csv.reader(my_file, delimiter=' ', skipinitialspace=True)
....:    for row in reader:
....:        print row
['Branch', 'Ra', 'L', 'C', 'Rb']
['1', '1', '10', '1', '1']
['2', '13', '100', '15', '6']


You should be able to conclude from this.