Re: reading from a txt file

2015-11-26 Thread Pedro Vincenty
All were really helpful thanks a lot. Now I'm interested in identifying a particular index after being able to print out each word. Printing each word to the console I have : ['METEOSAT-7'] ['1', '24932U', '97049B', '15319.57839525', '.0058', '0-0', '0+0', '0', '9994'] ['2', '249

Re: reading from a txt file

2015-11-26 Thread Gary Herron
On 11/26/2015 12:34 PM, vincentype...@gmail.com wrote: Hey, I'm wondering how to read individual strings in a text file. I can read a text file by lines with .readlines() , but I need to read specifically by strings, not including spaces. Thanks in advance Read the lines with readlines(), a

Re: reading from a txt file

2015-11-26 Thread Jason Friedman
> > Hey, I'm wondering how to read individual strings in a text file. I can > read a text file by lines with .readlines() , > but I need to read specifically by strings, not including spaces. Thanks > in advance > How about: for a_string in open("/path/to/file").read().split(): print(a_stri

Re: reading from a txt file

2015-11-26 Thread Denis McMahon
On Thu, 26 Nov 2015 12:34:36 -0800, vincentypedro wrote: > Hey, I'm wondering how to read individual strings in a text file. I can > read a text file by lines with .readlines() , > but I need to read specifically by strings, not including spaces. > Thanks in advance How do you define a string?

reading from a txt file

2015-11-26 Thread vincentypedro
Hey, I'm wondering how to read individual strings in a text file. I can read a text file by lines with .readlines() , but I need to read specifically by strings, not including spaces. Thanks in advance -- https://mail.python.org/mailman/listinfo/python-list

Re: reading from a txt file

2005-03-30 Thread MyHaz
you should have that file i/o in some try: except: pairs for starters. and you should close data_file when you are done. isn't it just data_file.read() ? -- http://mail.python.org/mailman/listinfo/python-list

reading from a txt file

2005-03-29 Thread jrlen balane
how should i modify this data reader: (assumes that there is only one entry per line followed by '\n') data_file = open(os.path.normpath(self.TextFile.GetValue()), 'r') data = data_file.readlines() self.irradianceStrings = map(str, data) self.irradianceIntegers = map(int, data) self.Irrad