Reading with xlrd in python
Question: I wrote this program to read a column from an excel file then write it into a
txt file:

    
    
    import xlrd, sys
    
    text_file = open("Output.txt", "w")
    isotope = xlrd.open_workbook(sys.argv[1])
    first_sheet=isotope.sheet_by_index(0)
    x= []
    for rownum in range(first_sheet.nrows):
        x.append(first_sheet.cell(rownum, 1))
    
    for item in x:
      text_file.write("%s\n" % item)
    
    text_file.close()
    

It reads the column correctly but writes it like so:

    
    
    number:517.0
    number:531.0
    number:517.0
    number:520.0
    number:513.0
    number:514.0
    number:522.0
    

Can I read it in a way that it just writes the value and not "number:"? I
could just cut out the first 7 characters of every line, but that seems kind
of inefficient. Thanks for the help!


Answer: Also, if you want a way to read entire values of a row in one shot:

You can take first_sheet and do:

    
    
    first_sheet.row_values(index_of_row)
    

This will return a list with all the values of the index_of_row.

