Thank you. That gives me something closer to a list, but the output is now: ['939\n', '936\n', '937\n', '885\n', '886\n', '887\n', '171\n', '19\n', ...]I’m having a hard time figuring out how to input a list of numbers, each one of which can be 1, 2, or 3 digits in length. First, I select a column in an Excel file, and copy and past it into a Word file. I then save it as a text file. I then open a new window in Python and copy and paste the column of numbers from the text file into the window and save it as ‘Function ID’Try open (or file) with mode 'rU' (universal newline support), apparently the \r is not recognized as \n
In my main program, I type
input=open('Function ID', 'r')
x=input.readlines()
input.close()
print x
Best regards,
Henning Hraban Ramm
Südkurier Medienhaus / MediaPro
Support/Admin/Development Dept.
Question: how do I get rid of the \n attached to each member in my list? I still need to do a lot of work with the contents of the list. I could run each member of the list through a loop and slice off the \n, but I imagine there is a more efficient way to do the job. Is there?
Thank you for your help.
Kirk
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig