Re: [Tutor] Replacing the string in a file

2010-01-21 Thread Shashwat Anand
Editing original file can be risky at times. If @vanam wants to edit the same fie, he can open the original file, read it, rename it to say 'data.txt.bak' and then write the modified content to the file named as 'data.txt'. This way he gets the data in the file he wants and also have a backup of or

Re: [Tutor] Replacing the string in a file

2010-01-21 Thread Stefan Behnel
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 temporary file. When done,

Re: [Tutor] Replacing the string in a file

2010-01-21 Thread Shashwat Anand
You can try it by reading all data as string, replacing the string and then write it to target file via opeing it in +w mode. f = open('data.txt', 'rw').read().replace('Python', 'PYTHON') f1 = open('data.txt', 'w') f1.write(f) HTH On Fri, Jan 22, 2010 at 12:14 PM, vanam wrote: > Hi all, > > I

[Tutor] Replacing the string in a file

2010-01-21 Thread vanam
Hi all, I have been trying to write a script where in it has to replace a particular string in a file and write back to the file without intact of the contents I have tried below mentioned steps, but of no avail: 1. Created a file by name data.txt and included some text (For instance, *

Re: [Tutor] Hello

2010-01-21 Thread vishwajeet singh
> > On Thu, Jan 21, 2010 at 11:03 PM, Samuel de Champlain < > samueldechampl...@gmail.com> wrote: > >> This is my first message to this mailing list. >> I want to create a project with glade and pygtk on fedora. >> Can you suggest a good IDE? >> > netbeans have worked quite well for me but its

Re: [Tutor] Hello

2010-01-21 Thread Robert
Check out wingware IDE and Geany. On Thu, Jan 21, 2010 at 12:33 PM, Samuel de Champlain wrote: > This is my first message to this mailing list. > I want to create a project with glade and pygtk on fedora. > Can you suggest a good IDE? > > ___ > Tutor m

Re: [Tutor] need help in python

2010-01-21 Thread Robert
And your question is ? On Thu, Jan 21, 2010 at 12:48 PM, invincible patriot wrote: > hi > I am a student and i need soe help regarding my assignmentif some one can > help me il be glad. > > i wil be waiting for the reply > > thanks > > ___ Tutor mailli

Re: [Tutor] need help in python

2010-01-21 Thread Luke Paireepinart
Don't post messages to the list in reply to other messages, it messes up threading. Other than that, you'll have to tell us more about your assignment if you want help. -Luke On Thu, Jan 21, 2010 at 11:48 AM, invincible patriot < invincible_patr...@hotmail.com> wrote: > hi > I am a student and i

Re: [Tutor] need help in python

2010-01-21 Thread Andreas Kostyrka
Am Donnerstag, 21. Januar 2010 18:48:36 schrieb invincible patriot: > hi > I am a student and i need soe help regarding my assignmentif some one can > help me il be glad. You do realize that assignments are things to be done by yourself? This is a mailing list, so just post your questions, but d

[Tutor] need help in python

2010-01-21 Thread invincible patriot
hi I am a student and i need soe help regarding my assignmentif some one can help me il be glad. i wil be waiting for the reply thanks Date: Thu, 21 Jan 2010 12:33:40 -0500 From: samueldechampl...@gmail.com To: tutor@python.org Subject: [Tutor] Hello This is my first message to this mailing

Re: [Tutor] Hello

2010-01-21 Thread Shashwat Anand
The choice of IDE is quite objective. Many of the people use vim/emacs exclusively for all the work. Eclipse with PyDev plugin too is a good choice. On Thu, Jan 21, 2010 at 11:03 PM, Samuel de Champlain < samueldechampl...@gmail.com> wrote: > This is my first message to this mailing list. > I wan

[Tutor] Hello

2010-01-21 Thread Samuel de Champlain
This is my first message to this mailing list. I want to create a project with glade and pygtk on fedora. Can you suggest a good IDE? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/lis

Re: [Tutor] combinatorics problem: assembling array

2010-01-21 Thread Kent Johnson
On Thu, Jan 21, 2010 at 8:07 AM, Kent Johnson wrote: > On Thu, Jan 21, 2010 at 4:06 AM, markus kossner wrote: >> Dear Pythonics, >> I have a rather algorithmic problem that obviously made a knot in my brain: >> >> Assume we have to build up all the arrays that are possible if we have a >> nested

Re: [Tutor] combinatorics problem: assembling array

2010-01-21 Thread spir
On Thu, 21 Jan 2010 10:06:40 +0100 markus kossner wrote: > Dear Pythonics, > I have a rather algorithmic problem that obviously made a knot in my brain: > > Assume we have to build up all the arrays that are possible if we have a > nested array > containing an array of integers that are allowed

Re: [Tutor] combinatorics problem: assembling array

2010-01-21 Thread Kent Johnson
On Thu, Jan 21, 2010 at 4:06 AM, markus kossner wrote: > Dear Pythonics, > I have a rather algorithmic problem that obviously made a knot in my brain: > > Assume we have to build up all the arrays that are possible if we have a > nested array > containing an array of integers that are allowed for

Re: [Tutor] Still searching in html files

2010-01-21 Thread Kent Johnson
On Thu, Jan 21, 2010 at 4:03 AM, Paul Melvin wrote: > The code is at http://python.codepad.org/S1ul2bh7 and the bit I would like > some advice on is how to get the sorted data and where to put it. Generally the code seems a bit disorganized, consider breaking it into functions. There is a fair a

Re: [Tutor] keeping track of the present line in a file

2010-01-21 Thread Kent Johnson
On Thu, Jan 21, 2010 at 1:57 AM, sudhir prasad wrote: > hi, > is there any other way to keep track of line number in a file other than > fileinput.filelineno() With enumerate(): for line_number, line in enumerate(open('myfile.txt')): # etc Kent ___

[Tutor] combinatorics problem: assembling array

2010-01-21 Thread markus kossner
Dear Pythonics, I have a rather algorithmic problem that obviously made a knot in my brain: Assume we have to build up all the arrays that are possible if we have a nested array containing an array of integers that are allowed for each single position. For example the nested array ( (1,2,3,89)

[Tutor] Need help, tutoring Python

2010-01-21 Thread Neal Mendelsohn
I am looking for someone who knows WordPress to spend an hour with me on the phone and with a shared screen to coach me on how WordPress can be configured using Python files. Can you refer me? Thanks, NM ___ Tutor maillist - Tutor@python.org To uns

Re: [Tutor] Still searching in html files

2010-01-21 Thread Stefan Behnel
Paul Melvin, 21.01.2010 10:03: > I am still looking for information in these files and have a sort of > 'clunky' solution that I would like feedback on please. > > The code is at http://python.codepad.org/S1ul2bh7 and the bit I would like > some advice on is how to get the sorted data and where t

[Tutor] Still searching in html files

2010-01-21 Thread Paul Melvin
Hi, I am still looking for information in these files and have a sort of 'clunky' solution that I would like feedback on please. The code is at http://python.codepad.org/S1ul2bh7 and the bit I would like some advice on is how to get the sorted data and where to put it. Currently I use a

Re: [Tutor] keeping track of the present line in a file

2010-01-21 Thread Alan Gauld
"sudhir prasad" wrote is there any other way to keep track of line number in a file other than fileinput.filelineno() You could always do it manually by incrementing a counter every time you read a line. But what's the problem with filelineno()? If you tell us what your problem is we mig