Re: [Tutor] Replacing the string in a file

2010-01-22 Thread Stefan Lesicnik
> > vanam, 22.01.2010 07:44: > > > [Query]: How to write Python string to PYTHON to that file without > > intact of the full contents > > What one would normally do is: read the file (line by line if that's > ok in > your case), replace the word by the new one, write the new line to a > new > te

Re: [Tutor] Replacing the string in a file

2010-01-22 Thread vanam
Thanks for your mail. As you have suggested i have changed the mode to 'rw' but it is throwing up an error as below *** IOError: [Errno 22] invalid mode ('rw') or filename: 'data.txt' *** I am using python 2.6.4. But Script is managed to pass with 'a+' mode/r+ mo

Re: [Tutor] Replacing the string in a file

2010-01-22 Thread Shashwat Anand
@vanam: If you open the file again with only '+w' and not '+rw', I guess you'll not be getting this error - > IOError: [Errno 22] invalid mode ('rw') or filename: 'data.txt' On Fri, Jan 22, 2010 at 1:51 PM, vanam wrote: > Thanks for your mail. > > As you have suggested i have changed the mode

Re: [Tutor] Replacing the string in a file

2010-01-22 Thread Stefan Behnel
Stefan Lesicnik, 22.01.2010 09:11: > I have used the fileinput module for this quiet alot. It has an inplace > option which does what you want and a backup option that keeps a backup. > > http://docs.python.org/library/fileinput.html > http://www.doughellmann.com/PyMOTW/fileinput/index.html Ah, r

Re: [Tutor] Replacing the string in a file

2010-01-22 Thread Shashwat Anand
and there is the everlasting : http://xkcd.com/353/ :D On Fri, Jan 22, 2010 at 2:16 PM, Stefan Behnel wrote: > Stefan Lesicnik, 22.01.2010 09:11: > > I have used the fileinput module for this quiet alot. It has an inplace > > option which does what you want and a backup option that keeps a back

Re: [Tutor] Replacing the string in a file

2010-01-22 Thread Dave Angel
vanam wrote: Thanks for your mail. As you have suggested i have changed the mode to 'rw' but it is throwing up an error as below *** IOError: [Errno 22] invalid mode ('rw') or filename: 'data.txt' *** I am using python 2.6.4. But Script is managed to pass wit

Re: [Tutor] Replacing the string in a file

2010-01-22 Thread Andreas Kostyrka
The modes for updating files are + suffixed. r+ Open for reading and writing. The stream is positioned at the beginning of the file. w+ Open for reading and writing. The file is created if it does not exist, otherwise it is trun‐ cated. The stream is p

[Tutor] parse text file

2010-01-22 Thread Norman Khine
Hello, I have the following http://paste.lisp.org/display/93732 txt file. >From this I would like to extract ... 'ACP' + 'En savoir plus' ); ... map.addOverlay(marqueur[1]);var latlng = new GLatLng(9.696333,

Re: [Tutor] create an object from a class in dll with ctypes?

2010-01-22 Thread katrin schmid
hi, it worked great, i am just wondering if the resulting .pyd is plattform dependent? If i create one on windows would linux user need another one? Thank you, katrin Original-Nachricht > Datum: Tue, 19 Jan 2010 23:49:14 -0800 > Von: "Mark Tolonen" > An: tutor@python.org > Bet

Re: [Tutor] parse text file

2010-01-22 Thread Norman Khine
Hi On Fri, Jan 22, 2010 at 7:44 PM, spir wrote: > On Fri, 22 Jan 2010 14:11:42 +0100 > Norman Khine wrote: > >> but my problem comes when i try to list the GLatLng: >> >> GLatLng(9.696333, 122.985992); >> >> >>> StartingWithGLatLng = soup.findAll(re.compile('GLatLng')) >> >>> StartingWithGLatLng

Re: [Tutor] create an object from a class in dll with ctypes?

2010-01-22 Thread Alan Gauld
"katrin schmid" wrote if the resulting .pyd is plattform dependent? If i create one on windows would linux user need another one? A Windows DLL will not work on Linux and a Linux library will not work on Windows. You need one per OS. Alan G. __

Re: [Tutor] create an object from a class in dll with ctypes?

2010-01-22 Thread katrin schmid
hi, so how about 32 and 64 bit, do they need separat versions, too? So a pyd is an "actual" dll? Regrads, katrin Original-Nachricht > Datum: Sat, 23 Jan 2010 00:13:53 - > Von: "Alan Gauld" > An: tutor@python.org > Betreff: Re: [Tutor] create an object from a class in dll wi

Re: [Tutor] create an object from a class in dll with ctypes?

2010-01-22 Thread Mark Tolonen
"katrin schmid" wrote in message news:20100123021522.155...@gmx.net... hi, so how about 32 and 64 bit, do they need separat versions, too? So a pyd is an "actual" dll? Regrads, katrin Yes, to both questions. -Mark ___ Tutor maillist - Tutor@py

Re: [Tutor] create an object from a class in dll with ctypes?

2010-01-22 Thread katrin schmid
hi, and there is no portable way of distributing it? I could tranlate the cpp code to python but its really lame Regards, katrin Original-Nachricht > Datum: Fri, 22 Jan 2010 20:42:17 -0800 > Von: "Mark Tolonen" > An: tutor@python.org > Betreff: Re: [Tutor] create an obje

Re: [Tutor] create an object from a class in dll with ctypes?

2010-01-22 Thread katrin schmid
hi, so could i build a 64-bit windows version on win 32? And how? I have just been asked ... Regards, katrin Original-Nachricht > Datum: Sat, 23 Jan 2010 00:13:53 - > Von: "Alan Gauld" > An: tutor@python.org > Betreff: Re: [Tutor] create an object from a class in dll with c

Re: [Tutor] create an object from a class in dll with ctypes?

2010-01-22 Thread Alan Gauld
"katrin schmid" wrote and there is no portable way of distributing it? I could tranlate the cpp code to python but its really lame Native code is native code I'm afraid. You have to rebuild it for every platform. Thats one reason interpreted languages are becoming more popular because