Re: [Tutor] How to save text from a wxTextCtrl widget [was: Tutor Digest, Vol 32, Issue 70]

2006-10-17 Thread Luke Paireepinart
Pine Marten wrote: Did you create this code, or did someone give it to you? It looks like it's been made with BoaConstructor. If you're using Boa for development, you'd probably be better off using it to add your save functionality, rather than writing the code by hand. Unfortunately,

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-17 Thread Kent Johnson
Chris Hengge wrote: I chose the way I used the names because to me... outFile = open(aFile.lower(), 'w') # Open output buffer for writing. = open a file with lowercase name for writing. it is implied that aFile is from the zip, since it is created in the loop to read the zip..

[Tutor] Importing module - file system requests

2006-10-17 Thread Bernard Lebel
Hello, When I import a module in Python, I see that 6 file system operation are being made. All requests are for opening. I know very well what are the .py and and .pyc files. But I'm not so sure what are .pyd and .pyw, and why it's looking for a dll. Anyone can shed some light on this? Also, if

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-17 Thread Luke Paireepinart
Kent Johnson wrote: Chris Hengge wrote: I chose the way I used the names because to me... outFile = open(aFile.lower(), 'w') # Open output buffer for writing. = open a file with lowercase name for writing. it is implied that aFile is from the zip, since it is created in the loop to

[Tutor] python applets

2006-10-17 Thread Picio
Hello, I'm evaluating a way to build applets in python. Actually google told me that I can use Grail Jython Can you add/suggest other ways? The more easy to learn wins !!! thanks a lot for any answer. Picio ___ Tutor maillist - Tutor@python.org

Re: [Tutor] python applets

2006-10-17 Thread Kent Johnson
Picio wrote: Hello, I'm evaluating a way to build applets in python. Actually google told me that I can use Grail Jython Grail is a very old, very dead project to write a web browser in Python. Your users would have to use Grail for this to work. You can write Java applets in Jython, see

[Tutor] Help me abt this error

2006-10-17 Thread Asrarahmed Kadri
I am trying to write to a file, but I am getting this errror. IOError: (0, 'Error') Can someone explain what is it and whats the solution?? Thanks. Regards, Asrar ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] distribution

2006-10-17 Thread Joel Levine
I am writing code that people I work with want to pick up instantly for their own machines. BUT they may be using different platforms and different installations on those platforms. I'm writing on a Mac, using Python 2.4, numpy, and Tkinter. They are using Macs and PC's, who-knows-what vintage

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-17 Thread Chris Hengge
I find your example rather amusing, since it makes it sound like you want this fictional mechanic to pick his parts by the brand name, rather then by how well the part works (in description vs context)... Your analogy seems to push that the brand name would inherently give the descriptive name

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-17 Thread Chris Hengge
I get what you are trying to say.. but I'm looking at the code after changing names, and I think it makes more sense in the code my way because of the following lines..outFile = open(aFile.lower(), 'w')#open 'afile' named with lowercase to 'w'rite outFile.write(zFile.read(insideZip))#write what

Re: [Tutor] Help me abt this error

2006-10-17 Thread Luke Paireepinart
Asrarahmed Kadri wrote: I am trying to write to a file, but I am getting this errror. IOError: (0, 'Error') Can someone explain what is it and whats the solution?? No. Give us the actual source and the full traceback. Cheers, -Luke ___ Tutor

Re: [Tutor] distribution

2006-10-17 Thread Luke Paireepinart
Joel Levine wrote: I am writing code that people I work with want to pick up instantly for their own machines. BUT they may be using different platforms and different installations on those platforms. I'm writing on a Mac, using Python 2.4, numpy, and Tkinter. They are using Macs and

Re: [Tutor] Help me abt this error

2006-10-17 Thread Danny Yoo
I am trying to write to a file, but I am getting this errror. IOError: (0, 'Error') Can someone explain what is it and whats the solution?? Hi Asrarahmed, Did you read my response from the last few days? http://mail.python.org/pipermail/tutor/2006-October/049958.html Did you find it

Re: [Tutor] Help me abt this error

2006-10-17 Thread Luke Paireepinart
Oops, I replied off-list. Forwarding to list. ---BeginMessage--- Mike Hansen wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luke Paireepinart Sent: Tuesday, October 17, 2006 11:50 AM To: Asrarahmed Kadri Cc: pythontutor Subject: Re:

Re: [Tutor] A puzzle for you

2006-10-17 Thread Terry Carroll
On Sat, 14 Oct 2006, John Fouhy wrote: From the python_dev LiveJournal community --- Predict the outcome of the following code: ## from random import * seed() [choice(dict((x+1,0) for x in range(1000))) for x in range(693)][0] ## On ActivePython 2.4.3: from random import * seed()

Re: [Tutor] A puzzle for you

2006-10-17 Thread John Fouhy
On 18/10/06, Terry Carroll [EMAIL PROTECTED] wrote: On Sat, 14 Oct 2006, John Fouhy wrote: From the python_dev LiveJournal community --- Predict the outcome of the following code: ## from random import * seed() [choice(dict((x+1,0) for x in range(1000))) for x in range(693)][0]

Re: [Tutor] extracting numbers from a list

2006-10-17 Thread kumar s
In continuation to : Re: [Tutor] extracting numbers from a list hello list I have coordinates for exons (chunks of sequence). For instance: 10 - 50 A 10 - 20 B 35 - 50 B 60 - 70 A 60 - 70 B 80 - 100 A 80 - 100 B (The above coordinates and names are easier than in dat) Here my aim is to

[Tutor] Searching list items.

2006-10-17 Thread Chris Hengge
contents = readlines(myfile, 'r')Ok, I'm under the impression this is a list of strings (array)How in the world do I cycle through them looking for words?for line in contents: if line.contains(something) print lineThats a mock up of what I'm looking for. I tried to figure out how to use re, but

Re: [Tutor] Searching list items.

2006-10-17 Thread Luke Paireepinart
Chris Hengge wrote: contents = readlines(myfile, 'r') Ok, I'm under the impression this is a list of strings (array) Nope. No such thing as arrays in Python. It is a list of strings, that's it. :) How in the world do I cycle through them looking for words? for line in contents: if

Re: [Tutor] Searching list items.

2006-10-17 Thread Chris Hengge
I remove those lines, but I was trying to usefor line in contents: result = re.search(something, line) print resultthis printed out something like NoneNoneNonehex memory address of goodness NoneNone...On 10/17/06, Luke Paireepinart [EMAIL PROTECTED] wrote: Chris Hengge wrote: contents =

Re: [Tutor] Searching list items.

2006-10-17 Thread Luke Paireepinart
Chris Hengge wrote: I remove those lines, but I was trying to use for line in contents: result = re.search(something, line) print result I'm pretty sure this isn't how you use regular expressions. I have to go to class right now but if no one else has replied when I get back I'll look

Re: [Tutor] Searching list items.

2006-10-17 Thread Chris Hengge
An article at devshed was using it like that... but the output wasn't what I was looking for.. I was getting the hex address where the result was, but not printing the line.. I think the simple code you recommended in your first reply will do the trick, I'm not looking for anything magical, just

Re: [Tutor] Searching list items.

2006-10-17 Thread John Fouhy
On 18/10/06, Chris Hengge [EMAIL PROTECTED] wrote: I remove those lines, but I was trying to use for line in contents: result = re.search(something, line) print result this printed out something like None None None hex memory address of goodness None None If you don't need a

Re: [Tutor] Searching list items.

2006-10-17 Thread Danny Yoo
I remove those lines, but I was trying to use for line in contents: result = re.search(something, line) print result 'result' here is going to either be None, as you've seen, or a match object. We have several options available to use once we have a match. Take a look at a few of

Re: [Tutor] Help me abt this error

2006-10-17 Thread Asrarahmed Kadri
I changed to append mode and itis working. But the thing is that I have another problem. I am trying to insert usernames that are unique. Please look at the code and help me. import sys fd = open('usr.txt','a') def chk(str): global fd fd.seek(0,0) print fd done = 0 list1 = [] answer = True while

[Tutor] My apologyRe: Help me abt this error

2006-10-17 Thread Asrarahmed Kadri
I am so sorry.. if anyone felt offended.. I am a bit nervous about teh whole thing.. I am learning the language as well as i have a deadline to complete my project which is on Tkinter.. Dont mind.. I acknowledge the help from all the people out here.. Thanks. God Bless. Regards, Asrar On

Re: [Tutor] Help me abt this error

2006-10-17 Thread Luke Paireepinart
Asrarahmed Kadri wrote: I changed to append mode and it is working. But the thing is that I have another problem. I am trying to insert usernames that are unique. Please look at the code and help me. import sys fd = open('usr.txt','a') append mode is write-only. more comments further

Re: [Tutor] My apologyRe: Help me abt this error

2006-10-17 Thread Luke Paireepinart
Asrarahmed Kadri wrote: I am so sorry.. if anyone felt offended.. I don't think anyone was offended :) I am a bit nervous about teh whole thing.. I am learning the language as well as i have a deadline to complete my project which is on Tkinter.. Why do you have a deadline? Is it a

[Tutor] followup on python cookies/sessions (fwd)

2006-10-17 Thread Danny Yoo
-- Forwarded message -- Date: Mon, 16 Oct 2006 14:19:53 -0700 (PDT) From: anil maran [EMAIL PROTECTED] To: Danny Yoo [EMAIL PROTECTED] Subject: followup on python cookies/sessions Dear Danny My login code looks like this for session and cookie i dont know how to combine both

Re: [Tutor] Tutor Digest, Vol 32, Issue 72

2006-10-17 Thread Pine Marten
(in reference to a question I had about how to simply save the content of a textCtrl to a text file) #Okay, here is the function we need to change. def OnSaveButton(self, event): #from John's save(event) function: # #savefile = open(self.filename, 'w')

Re: [Tutor] extracting numbers from a list

2006-10-17 Thread Danny Yoo
On Mon, 16 Oct 2006, kumar s wrote: I have a simple question to ask tutors: list A : a = [10,15,18,20,25,30,40] Hi Kumar, If you're concerned about correctness, I'd recommend that you try thinking about the problem inductively. An inductive definition for what you're asking is

Re: [Tutor] Tutor Digest, Vol 32, Issue 72

2006-10-17 Thread Luke Paireepinart
I tried it and it did work this time, thanks so much. Your effort may keep me trying bit by bit to gain a little profiency. I'm glad that you're not going to give up just yet! Don't worry, I have much more effort in store for you :) And yes, I believe I see how much of this ought to

Re: [Tutor] A puzzle for you

2006-10-17 Thread Bob Gailer
John Fouhy wrote: From the python_dev LiveJournal community --- Predict the outcome of the following code: ## from random import * seed() [choice(dict((x+1,0) for x in range(1000))) for x in range(693)][0] ## Well the discussion did not go very far! You got my prediction and one