[Pythonmac-SIG] inputing multi-digit numbers

Craig Amundsen cdamundsen at gmail.com
Thu Nov 10 16:16:16 CET 2005


Hi -

> > 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', ...]

You could do:

inf = open(fileName)
numbers = inf.read().splitlines()

splitlines() is smarter than readlines()

- Craig


More information about the Pythonmac-SIG mailing list