Re: [Tutor] file methods

2007-07-10 Thread Dave Kuhlman
On Tue, Jul 10, 2007 at 08:24:36AM -0400, bhaaluu wrote: > Thank you for the clarification. > One pitfall of experimentation as a Noob is in not knowing enough to > figure out what or why errors are generated. Thus, this Tutor list is very > helpful. I really appreciate the feedback. > You might

Re: [Tutor] file methods

2007-07-10 Thread Mike Hansen
> -Original Message- >[...] > I have a file like this one: > > command = func_babara > parameter_1 = 300 > parameter_2 = 300 > parameter_3 = 50 > parameter_4 = 0 > parameter_5 = 0 > parameter_6 = 0 > > > ,as you see, i need to process it one line at a time and use > this .ini file

Re: [Tutor] file methods

2007-07-10 Thread bhaaluu
Greetings, On 7/9/07, John Fouhy <[EMAIL PROTECTED]> wrote: > On 10/07/07, bhaaluu <[EMAIL PROTECTED]> wrote: > > >>> file.readlines() > > Traceback (most recent call last): > > File "", line 1, in ? > > AttributeError: 'str' object has no attribute 'readlines' > > This error here is caused by t

Re: [Tutor] file methods

2007-07-10 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > python 3.9 File Objects of Python Library Reference > Learning to program from the reference manual is possible, especially if you use the interpreter to experiment as John has suggested. But it will be much faster and less error prone if you just work th

Re: [Tutor] file methods

2007-07-10 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote >> The best way to find out what the functions do is to experiment >> with them. >> >> eg: >> >> >>> f = open('text.txt', 'r') >> >>> f.readlines() >> >> and look at the output. > > I like that idea. I made a simple english plain text file, thus: > > first lin

Re: [Tutor] file methods

2007-07-09 Thread John Fouhy
On 10/07/07, bhaaluu <[EMAIL PROTECTED]> wrote: > >>> file.readlines() > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'str' object has no attribute 'readlines' This error here is caused by this earlier statement: > >>> file=open('text.txt').read() 'file' is now

Re: [Tutor] file methods

2007-07-09 Thread bhaaluu
Greetings, On 7/9/07, John Fouhy <[EMAIL PROTECTED]> wrote: > > The best way to find out what the functions do is to experiment with them. > > eg: > > >>> f = open('text.txt', 'r') > >>> f.readlines() > > and look at the output. I like that idea. I made a simple english plain text file, thus: fi

Re: [Tutor] file methods

2007-07-09 Thread John Fouhy
On 10/07/07, elis aeris <[EMAIL PROTECTED]> wrote: > from the document i know that if I want to open a text file I do: > > f = open("text.txt", "r+") > > and thus create f as an file object i can then use. > > however, i don't understand these functions > > .readline > .readlines > .read > .xlinesr

Re: [Tutor] file methods

2007-07-09 Thread Luke Paireepinart
elis aeris wrote: > python 3.9 File Objects of Python Library Reference > > > > from the document i know that if I want to open a text file I do: > > f = open("text.txt", "r+") > > and thus create f as an file object i can then use. > > however, i don't understand these functions > > .readline > .