Re: [Tutor] Working with files with python (gtk)

2007-03-15 Thread Eike Welk
Hello Edward! On Thursday 15 March 2007 03:53, Edward A Robinson wrote: > I guess what Im looking for is a python command that dose what the > file command in the shell would do I don't think there is anything like this in Python's standard library. Probably Gnome has a library for identifying t

Re: [Tutor] Working with files with python (gtk)

2007-03-15 Thread Tim Golden
Edward A Robinson wrote: > I guess what Im looking for is a python command that dose what the > file command in the shell would do > > On 3/14/07, Edward A Robinson <[EMAIL PROTECTED]> wrote: >> This is my first time posting to the python tutor so be nice, I have >> read the mailing list and cant

Re: [Tutor] Working with files with python (gtk)

2007-03-14 Thread Edward A Robinson
I guess what Im looking for is a python command that dose what the file command in the shell would do On 3/14/07, Edward A Robinson <[EMAIL PROTECTED]> wrote: > This is my first time posting to the python tutor so be nice, I have > read the mailing list and cant seem to find and answer there or on

Re: [Tutor] Working with files

2005-08-26 Thread Alan Gauld
> Alan, you missed the last part of the code - he writes the rest of > the data following the match into the file. I didn't miss it but I did misread it! :-) >file.write(contents[pos + len(name):]) I assumed 'name' was here referring to the actual value inserted. But of course that would hav

Re: [Tutor] Working with files

2005-08-26 Thread Kent Johnson
Alan G wrote: > ARe you sure? The problem using seek and write is that if the data > you are inserting is bigger than your marker you will overwrite the > data following the marker. Alan, you missed the last part of the code - he writes the rest of the data following the match into the file. Thi

Re: [Tutor] Working with files

2005-08-26 Thread Alan G
> > basically I took the idea and the code example given and wrote this > little function, i stuck vars in this html page like #email# and > just used it like this, " insertdata('#email#','[EMAIL PROTECTED]') > > works perfect! ARe you sure? The problem using seek and write is that if the data y

Re: [Tutor] Working with files

2005-08-25 Thread Scott Oertel
Bob Gailer wrote: > At 02:55 PM 8/24/2005, Scott Oertel wrote: > >> How do I use the built in file objects to insert text into a file at a >> certain location? >> >> i.e. >> >> something, 2, chance, weee >> nothing, happened, crap, nice >> >> need to search for "something" and insert, "what,"

Re: [Tutor] Working with files

2005-08-24 Thread Scott Oertel
Byron wrote: Bob Gailer wrote: read the file into a string variable (assuming the file is not humungus) find the location of "something" in the string assemble a new string consisting of: the original string up to the location (index) of "something" "what" the rest of the

Re: [Tutor] Working with files

2005-08-24 Thread Byron
Bob Gailer wrote: > read the file into a string variable (assuming the file is not humungus) > find the location of "something" in the string > assemble a new string consisting of: >the original string up to the location (index) of "something" >"what" >the rest of the original string >

Re: [Tutor] Working with files

2005-08-24 Thread Bob Gailer
At 02:55 PM 8/24/2005, Scott Oertel wrote: >How do I use the built in file objects to insert text into a file at a >certain location? > >i.e. > >something, 2, chance, weee >nothing, happened, crap, nice > > need to search for "something" and insert, "what," before it Here's the algorithm. If y