[Pythonmac-SIG] inputing multi-digit numbers

Kirk Durston kdurston at uoguelph.ca
Thu Nov 10 01:59:40 CET 2005


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¹

In my main program, I type

input=open('Function ID', 'r')
x=input.readlines()
input.close()
print x

What I get, when x is printed out, looks like this:

['939\r936\r937\r885\r886\r887\r171\r19\r169\r149\r36\r37\r38\r1\r51\r81\r10
2\r827\r919\r14\r85\r20\r895\r88\r89\r167\r163\r111\r168\r128\r66\r880\r884\
r71\r131\r67\r419\r415\r68\r103\r82\r2\r39\r40\r41\r132\r107\r123\r150\r155\
r897\r901\r911\r949\r21\r15\r9\r883\r129\r69\r70\r130\r124\r112\r142\r164\r1
59\r881\r882\r72\r22\r23\r24\r3\r108\r133\r388\r113\r160\r165\r393\r156\r144
\r161\r25\r4\r134\r905\r907\r26\r114\r95\r96\r162\r174\r27\r125\r389\r888\r1
45\r16\r100\r126\r28\r891\r5\r115\r143\r75\r29\r73\r74\r76\r98\r83\r104\r30\
r42\r43\r44\r151\r172\r109\r135\r6\r940\r892\r912\r903\r898\r17\r10\r390\r13
6\r116\r45\r46\r47\r899\r173\r146\r117\r31\r77\r894\r893\r900\r902\r913\r7\r
941\r938\r910\r11\r78\r105\r84\r32\r48\r49\r50\r118\r110\r127\r101\r137\r152
\r79\r80\r908\r906\r33\r138\r909\r890\r153\r154\r157\r170\r106\r416\r914\r92
1\r8\r12\r13\r18\r34\r99\r139\r147\r392\r']

What I want is [Œ939¹, Œ936¹, ... ,¹392¹]

What am I doing wrong?

Kirk


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051109/846a91ae/attachment.html


More information about the Pythonmac-SIG mailing list