Re: Question about Reading from text file with Python's Array class

2011-12-18 Thread Tim Chase
On 12/18/11 12:33, traveller3141 wrote: To test this, I made a small sample file (sillyNums.txt) as follows; 109 345 2 1234556 f=open("sillyNums.txt","r") data = array.array('i') data.fromstring(f.read(data.itemsize* bufferSize)) print data The output was nonsense: array('i', [171520049, 171258

Re: Question about Reading from text file with Python's Array class

2011-12-18 Thread Peter Otten
traveller3141 wrote: > I've been trying to use the Array class to read 32-bit integers from a > file. There is one integer per line and the integers are stored as text. > For problem specific reasons, I only am allowed to read 2 lines (2 32-bit > integers) at a time. > > To test this, I made a sm

Question about Reading from text file with Python's Array class

2011-12-18 Thread traveller3141
I've been trying to use the Array class to read 32-bit integers from a file. There is one integer per line and the integers are stored as text. For problem specific reasons, I only am allowed to read 2 lines (2 32-bit integers) at a time. To test this, I made a small sample file (sillyNums.txt) as

Re: Reading from text file

2008-08-26 Thread Fredrik Lundh
A. Joseph wrote: I want to read from text file, 25 lines each time i press enter key, just like the python documentation. you can use pydoc's pager from your program: import pydoc text = open(filename).read() pydoc.pager(text) -- http://mail.python.org/mailman/listinfo/python-

Reading from text file

2008-08-26 Thread A. Joseph
I want to read from text file, 25 lines each time i press enter key, just like the python documentation. i`m using Python 2.5, Windows XP Thank you -- http://mail.python.org/mailman/listinfo/python-list