Re: reading from file

2009-06-11 Thread Sydoruk Yaroslav
Jeff McNeil wrote: > Is the string in your text file literally "\xea\xe0\xea+\xef\xee > \xe7\xe2\xee\xed\xe8\xf2\xfc" as "plain text?" My assumption is that > when you're reading that in, Python is interpreting each byte as an > ASCII value (and rightfully so) rather than the corresponding '\x' >

Re: reading from file

2009-06-11 Thread Jeff McNeil
On Jun 11, 4:24 pm, Sydoruk Yaroslav wrote: > Hello all, > > In a text file aword.txt, there is a string: >     "\xea\xe0\xea+\xef\xee\xe7\xe2\xee\xed\xe8\xf2\xfc". > > There is a first script: > f = open ("aword.txt", "r") > for line in f: >     print chardet.detect(line) >     b = line.decode('c

reading from file

2009-06-11 Thread Sydoruk Yaroslav
Hello all, In a text file aword.txt, there is a string: "\xea\xe0\xea+\xef\xee\xe7\xe2\xee\xed\xe8\xf2\xfc". There is a first script: f = open ("aword.txt", "r") for line in f: print chardet.detect(line) b = line.decode('cp1251') print b _RESULT_ {'confidence': 1.0, 'encoding': '

Re: how to optimize object creation/reading from file?

2009-01-28 Thread perfreem
On Jan 28, 10:06 am, Bruno Desthuilliers wrote: > perfr...@gmail.com a écrit : > > > > > hi, > > > i am doing a series of very simple string operations on lines i am > > reading from a large file (~15 million lines). i store the result of > > these operations in a simple instance of a class, and t

Re: how to optimize object creation/reading from file?

2009-01-28 Thread Bruno Desthuilliers
perfr...@gmail.com a écrit : hi, i am doing a series of very simple string operations on lines i am reading from a large file (~15 million lines). i store the result of these operations in a simple instance of a class, and then put it inside of a hash table. i found that this is unusually slow..

how to optimize object creation/reading from file?

2009-01-28 Thread perfreem
hi, i am doing a series of very simple string operations on lines i am reading from a large file (~15 million lines). i store the result of these operations in a simple instance of a class, and then put it inside of a hash table. i found that this is unusually slow... for example: class myclass(o