Re: [Tutor] I need advice.

2005-08-01 Thread Nathan Pinno
I forgot to tell that I use Python 2.2.3. When I first got Python, I got 2.4.1, but it refused to run the second time. So I went and got 2.2.3. Your answer would make sense if I had 2.4.1, but I don't. - Original Message - From: "Danny Yoo" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL

Re: [Tutor] QUESTION

2005-08-01 Thread Liam Clarke
This link - http://www.python.org/ftp/python/2.4.1/python-2.4.1.msi straight from the python.org website is for a Windows installer. May I also recommend this - http://wiki.python.org/moin/BeginnersGuide The Python Beginner's Guide? Good luck, Liam ClarkeOn 8/2/05, Jane MUIRI <[EMAIL PROTECTED

Re: [Tutor] I need advice.

2005-08-01 Thread Danny Yoo
On Mon, 1 Aug 2005, Nathan Pinno wrote: > I want to write a program that will convert time in any other time zone > to my time zone. Would it be better to use the Python time molecule or > just a whole bunch of if statements? Hi Nathan, I'd recommend looking at the 'datetime' Python module. G

Re: [Tutor] Question about BASIC and Python

2005-08-01 Thread Nathan Pinno
Thanks Bob and Liam. I was wondering myself. - Original Message - From: Bob Gailer To: Nathan Pinno ; Tutor mailing list Sent: Monday, August 01, 2005 11:09 PM Subject: Re: [Tutor] Question about BASIC and Python At 06:13 PM 8/1/2005, Nathan Pinno wrote:

[Tutor] QUESTION

2005-08-01 Thread Jane MUIRI
Hi! I'd like to know what kind of Python I can download. I've tried but in vain! My computer is windows xp servixe pack 1, version 2002. Please, tell me what to do. Jane. _ Express yourself instantly with MSN Messenger! Download today

Re: [Tutor] Question about BASIC and Python

2005-08-01 Thread Bob Gailer
At 06:13 PM 8/1/2005, Nathan Pinno wrote: Hi all,   I had a co-worker say to me at work that Python was related to or based upon BASIC. Is this true, and if not, how can I tell my friend why they are similar? There are many versions of BASIC (Beginners All-Purpose Symbolic Instruction Code) (or s

Re: [Tutor] Question about BASIC and Python

2005-08-01 Thread Liam Clarke
Erm erm erm having used Visual Basic, XBasic and QBasic, I can honestly say, that about the only similarity is that VB is more or less object orientated, and that they use modules. On 8/2/05, Nathan Pinno <[EMAIL PROTECTED]> wrote: Hi all,   I had a co-worker say to me at work

Re: [Tutor] terminology question

2005-08-01 Thread Dick Moores
[EMAIL PROTECTED] wrote at 21:52 8/1/2005: >Quoting Dick Moores <[EMAIL PROTECTED]>: > > > Why are list comprehensions called that? > >Because that's what they're called in Haskell, I guess.. This Haskell, I suppose? >It's historical, ba

Re: [Tutor] terminology question

2005-08-01 Thread jfouhy
Quoting Dick Moores <[EMAIL PROTECTED]>: > Why are list comprehensions called that? Because that's what they're called in Haskell, I guess.. It's historical, based on the term "set comprehension" from mathematics, also known as "set builder notation": http://en.wikipedia.org/wiki/Set_comprehensi

[Tutor] terminology question

2005-08-01 Thread Dick Moores
Why are list comprehensions called that? Thanks, Dick Moores [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] fourier transform (fwd)

2005-08-01 Thread Danny Yoo
Hi Jeff, > Yes, for an odd square wave the b's of the fourier series are non zero > for even values and zero for odd values of n. these are the coefficients > for the fourier series. Although I beleive the fft (fourier transform) > should return the amplitude of frequencies that exist. so for e

[Tutor] Question about BASIC and Python

2005-08-01 Thread Nathan Pinno
Hi all,   I had a co-worker say to me at work that Python was related to or based upon BASIC. Is this true, and if not, how can I tell my friend why they are similar?   Nathan Pinno,Crew, Camrose McDonalds and owner/operator of Woffee BEGIN:VCARD VERSION:2.1 N:Pinno;Nathan;Paul;Mr. FN:Pinno,

[Tutor] I need advice.

2005-08-01 Thread Nathan Pinno
Hey all,   I want to write a program that will convert time in any other time zone to my time zone. Would it be better to use the Python time molecule or just a whole bunch of if statements?   Waiting eagerly for an answer, Nathan Pinno,Crew, Camrose McDonalds and owner/operator of Woffee BEG

Re: [Tutor] fourier transform (fwd)

2005-08-01 Thread Danny Yoo
-- Forwarded message -- Date: Mon, 1 Aug 2005 16:21:33 -0700 (PDT) From: Jeff Peery <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] fourier transform Danny, thanks for the help. Yes, for an odd square wave the b's of the fourier series are non zero for

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Nathan Pinno
What if I were to use ID's for the students and use the ID's as the sequence index, and link the students and their grades to the IDs? Just a suggestion, Nathan Pinno - Original Message - From: "Danny Yoo" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]> Cc: "Tutor" Sent: Mond

Re: [Tutor] try except continue

2005-08-01 Thread Alan G
-- code here - def f(): if error: raise ValueError else: print "I'm in f()" def g(): print "I'm in g()" def h(): error = True print "error is: ", error n = 5 while n: print "n is: ", n n -= 1 try: f() g() except ValueError:

Re: [Tutor] fourier transform

2005-08-01 Thread Jeff Peery
ok, this makes more sense. what I want to know is the amplitude for the output frequencies. I'm using import FFT, and FFT.fft(). the first element of the output is the DC constant? not sure what this is. is the amplitude for all other elements plus the DC equal to the actual amplitude?   thanks.Paw

Re: [Tutor] fourier transform

2005-08-01 Thread Jeff Peery
ok, this makes more sense. what I want to know is the amplitude for the output frequencies. I'm using import FFT, and FFT.fft(). the first element of the output is the DC constant? not sure what this is. is the amplitude for all other elements plus the DC equal to the actual amplitude?   thanks.Paw

Re: [Tutor] fourier transform

2005-08-01 Thread Danny Yoo
On Mon, 1 Aug 2005, Jeff Peery wrote: > thanks for the help. I think I'm understanding this a bit better. > although I still don't completely understand the output. here is an > example... for the input I have 1024 samples taken from a 1 Hz square > wave with amplitude = 1. for the output I wou

Re: [Tutor] fourier transform

2005-08-01 Thread Jeff Peery
thanks for the help. I think I'm understanding this a bit better. although I still don't completely understand the output. here is an example... for the input I have 1024 samples taken from a 1 Hz square wave with amplitude = 1.  for the output I would expect an infinite number of frequencies. the

[Tutor] Question

2005-08-01 Thread Nathan Pinno
Hi all,   Just curious to wonder if Python can be used to write a program to check an HTTP mail server for mail, and check more than one server, even if they are using different proxies, i.e. HTTP for one and SMTP for the other.   Thanks, Nathan Pinno,Crew, Camrose McDonalds and owner/operator

Re: [Tutor] question on string

2005-08-01 Thread Gilbert Tsang
Thank you all for the enthusiastic responses. It must have been other part of the script since the command string construction now works. I also realized that "file" is a poor choice of variable name. Thanks Danny for telling me about the subprocess module. Best regards, Gilbert. ZIYAD A. M.

Re: [Tutor] Color text in Text widget

2005-08-01 Thread Alan G
> I use the text's configuration to define tags that I apply to > sections of the text. For example: > > txtBox = Text(self, width=80, height=20) > # configuration for red > txtBox.insert(END,"I am red ", "r") I don't know if it's the absolute best way but I didn't know you could do that and I th

Re: [Tutor] counting problem

2005-08-01 Thread Alan G
> What I want to do is quickly count the number of lines that share a > value in the 4th column and 5th (i.e. in this line I would count all > the line that have '9' and 'ZZZ'). Anyone got any ideas for the > quickest way to do this? The solution I have is really ugly. thanks, Pesonally I'd jus

Re: [Tutor] question on string

2005-08-01 Thread Bob Gailer
At 10:42 AM 8/1/2005, Gilbert Tsang wrote: Hi there, I would like to construct some string objects using the cprintf-style format: command_string = "diff -u %s %s > %s.patch" % ( src, dst, file ) Of course it is illegal in python How did you conclude that? "diff -u %s %s > %s.patch" % ( src, dst

Re: [Tutor] question on string

2005-08-01 Thread Alan G
> I would like to construct some string objects using the > cprintf-style format: > > command_string = "diff -u %s %s > %s.patch" % ( src, dst, file ) Should work - assuming the 3 variables are defined! Although file is a bad name for a variable since its also the name of the function for opening

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Danny Yoo
On Mon, 1 Aug 2005, Nathan Pinno wrote: > I've seem to run into a jam while working on the exercise on file I/O. > Here's the error: > Filename to save: university.txt > Traceback (most recent call last): > File "D:\Python22\grades.py", line 99, in ? > save_grades(students,filename) > Fi

Re: [Tutor] try except continue

2005-08-01 Thread tpc247
hi guys, so I've been running through Alan's code, and for a while I suspected that the try block must be the first line of code after the loop in order to be executed. The reason I say this is I wanted to see for myself Alan's assertion that the continue skips to the next iteration, instead of co

Re: [Tutor] visibility of variables

2005-08-01 Thread Alan G
> I have problems with the visibility of variables in python. I am > used to the idea of Javascript and other languages where one can > define > global variables if they are defined outside a function. It seems > Python > is not doing that, but how can I make it work? Kent has answered the quest

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Adam Bark
No sorry scratch that last one I was being stupid. The key is a string but max_points is a list so the list index max_points[x] is effectively looking for max_points[student]. def save_grades(students,filename):     out_file = open(filename, "w")     for x in students.keys():     out_file.w

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Nathan Pinno
Maybe I should use assignments instead? - Original Message - From: Adam Bark To: Nathan Pinno Cc: tutor@python.org Sent: Monday, August 01, 2005 2:47 PM Subject: Re: [Tutor] I've run into a jam on the exercise on file I/O >>> max_points = [25,25,50,25,100]>

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Adam Bark
>>> max_points = [25,25,50,25,100] >>> assignments = ['hw ch 1','hw ch 2','quiz   ','hw ch 3','test'] >>> students = {'#Max':max_points} >>> students {'#Max': [25, 25, 50, 25, 100]} The problem is the key in students is a list not an integer.On 8/1/05, Nathan Pinno <[EMAIL PROTECTED] > wrote:

Re: [Tutor] counting problem

2005-08-01 Thread Danny Yoo
On Mon, 1 Aug 2005, Kent Johnson wrote: > [EMAIL PROTECTED] wrote: > > hi, > > > > I have large txt file with lines like this: > > > > ['DDB0216437'] 116611749 ZZZ 100 > > > > What I want to do is quickly count the number of lines that share a > > value in the 4th column and 5

[Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Nathan Pinno
Hey all, I've seem to run into a jam while working on the exercise on file I/O. Here's the error: Filename to save: university.txtTraceback (most recent call last):  File "D:\Python22\grades.py", line 99, in ?    save_grades(students,filename)  File "D:\Python22\grades.py", line 51, in save_

Re: [Tutor] Socket Programming

2005-08-01 Thread Adam Bark
Hi Joe you can use 1 and just send 'Hi!' as long as something else isn't likely to be sent at the same time. It will just read what is in that socket when you call it so if something else that you don't want is there just behind what you're after then you could end up with that as well.On 8/1/0

Re: [Tutor] counting problem

2005-08-01 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > hi, > > I have large txt file with lines like this: > > ['DDB0216437']116611749 ZZZ 100 > > What I want to do is quickly count the number of lines that share a value > in the 4th column and 5th (i.e. in this line I would count all the line > tha

Re: [Tutor] Color text in Text widget

2005-08-01 Thread Jorge Louis de Castro
I found a way to do it but I'm not sure it is the cleanest. Maybe someone else on this list can offer a better solution. I use the text's configuration to define tags that I apply to sections of the text. For example: txtBox = Text(self, width=80, height=20) # configuration for red txtBox.tag_c

[Tutor] counting problem

2005-08-01 Thread cgw501
hi, I have large txt file with lines like this: ['DDB0216437'] 116611749 ZZZ 100 What I want to do is quickly count the number of lines that share a value in the 4th column and 5th (i.e. in this line I would count all the line that have '9' and 'ZZZ'). Anyone got any ideas for t

Re: [Tutor] question on string

2005-08-01 Thread Danny Yoo
On Mon, 1 Aug 2005, Kent Johnson wrote: > > I would like to construct some string objects using the cprintf-style > > format: > > > > command_string = "diff -u %s %s > %s.patch" % ( src, dst, file ) > > > > Of course it is illegal in python but I couldn't figure out a way to > > construct string

Re: [Tutor] mailman

2005-08-01 Thread Danny Yoo
On Mon, 1 Aug 2005, Mohammad Moghimi wrote: > I want to install mailman. [cut] Hi Mohammad, This is the python-tutor mailing list: we help in teaching how to program in Python. However, we aren't the technical support group for the Mailman mailing list software, and we probably won't be able

[Tutor] Color text in Text widget

2005-08-01 Thread sunny sunny
Hi all, How do I add color to the text in the Text widget? I tried using the ASCII sequence but it didnt work. For example, I want to add: This is red , but this is blue Thanks. Santosh. ___ Tutor maillist - Tutor@python.org http://mail.python.or

Re: [Tutor] question on numarray across platforms

2005-08-01 Thread Danny Yoo
On Mon, 1 Aug 2005, Xiangyi Meng wrote: > > I ran across this error when running a few lines of code in debian > python, but this runs perfectly in windows python. Hi Xiangyi, This seems a bit specific to numarray; you may want to ask the Numeric discussion group: http://sourceforge.net/ma

Re: [Tutor] Socket Programming

2005-08-01 Thread Joseph Quigley
Hi, Ok. But what if I wanted to send a 1 mb message? Could I leave .recv(1) in and send 'Hi!' as well or would I have to change it? Thanks, JQ Adam Bark wrote: > You have to put in how many bytes of data you want to recieve in > clientsocket.recv() eg. clientsocket.recv(1024) for 1kB.

Re: [Tutor] question on string

2005-08-01 Thread ZIYAD A. M. AL-BATLY
On Mon, 2005-08-01 at 10:42 -0700, Gilbert Tsang wrote: > Hi there, > > I would like to construct some string objects using the cprintf-style > format: > > command_string = "diff -u %s %s > %s.patch" % ( src, dst, file ) > > Of course it is illegal in python but I couldn't figure out a way to

Re: [Tutor] cant get started

2005-08-01 Thread Danny Yoo
On Mon, 1 Aug 2005, Alan G wrote: > I'm cc'ing this back to the tutor list because others may spot things > I miss. > > >K something must be wrong cause I typed python and it said "python is > >not > > defined" so any ideas Hi Alan, Are you sure that F22AceRaptor isn't trying to type 'python

Re: [Tutor] Is input a Python function or command?

2005-08-01 Thread Danny Yoo
> Thanks Luke. Saved me quite a headache. I will use in_file instead. > Makes more sense anyway. Hi Nathan, Just wanted to chime in here: you may have fewer issues with name conflicts if you use more functions. For example: ## >>> def test(): ... input = 42 ... print input ... >>

Re: [Tutor] question on string

2005-08-01 Thread Kent Johnson
Gilbert Tsang wrote: > Hi there, > > I would like to construct some string objects using the cprintf-style > format: > > command_string = "diff -u %s %s > %s.patch" % ( src, dst, file ) > > Of course it is illegal in python but I couldn't figure out a way to > construct strings with that kind

Re: [Tutor] When I run this code, it just keeps repeating.

2005-08-01 Thread Bob Gailer
At 06:55 PM 7/30/2005, Nathan Pinno wrote: ...     elif cal_opt == 4:     X = input("First number:" )     Y = input("Second number:" )     if Y == 0:     print "Division by zero ot allowed!"     Y = input("Second number:" )     else:     print X, "/", Y, "=

[Tutor] question on string

2005-08-01 Thread Gilbert Tsang
Hi there, I would like to construct some string objects using the cprintf-style format: command_string = "diff -u %s %s > %s.patch" % ( src, dst, file ) Of course it is illegal in python but I couldn't figure out a way to construct strings with that kind of formatting and substitution. I have

Re: [Tutor] visibility of variables

2005-08-01 Thread Victor Reijs
THANKS Kent. It seems I used the wrong keywords to find answer to my question. This page is very very helpfull! I now works indeed. THANKS for your fast help. All the best, Victor Kent Johnson wrote: >>I have problems with the visibility of variables in python. I am >>used to the idea of Javasc

Re: [Tutor] visibility of variables

2005-08-01 Thread Kent Johnson
Victor Reijs wrote: > Hello all of you, > > I have problems with the visibility of variables in python. I am > used to the idea of Javascript and other languages where one can define > global variables if they are defined outside a function. It seems Python > is not doing that, but how can I make

[Tutor] visibility of variables

2005-08-01 Thread Victor Reijs
Hello all of you, I have problems with the visibility of variables in python. I am used to the idea of Javascript and other languages where one can define global variables if they are defined outside a function. It seems Python is not doing that, but how can I make it work? I think it needs some

[Tutor] mailman

2005-08-01 Thread Mohammad Moghimi
I want to install mailman. when I try to configure it I got this error message: checking for --with-python... no checking for python... /usr/bin/python checking Python interpreter... /usr/bin/python checking Python version... 2.4 checking that Python has a working distutils... configure: error: **

[Tutor] question on numarray across platforms

2005-08-01 Thread Xiangyi Meng
Hi there, I ran across this error when running a few lines of code in debian python, but this runs perfectly in windows python. Basically I created a dummy matrix called "gamma" (using kroneckerproduct in numarray) and printed out its mean. Here is the code: gamma = kroneckerproduct(ones((N, 1))

Re: [Tutor] Socket Programming

2005-08-01 Thread Joseph Quigley
Hi Johan, Johan Geldenhuys wrote: > I have more advanced examples if you want them, but start here and > look at the socket lib and you can start using select if you want to > wait for stuff from the server or client. > > Johan I'd love to see your examples. Could you send them directly to m

[Tutor] Re; Socket Programming

2005-08-01 Thread Joseph Quigley
Hi Kent, I have Python in a nutshell but I haven't read much. Thanks for tellling me. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Socket Programming

2005-08-01 Thread Adam Bark
You have to put in how many bytes of data you want to recieve in clientsocket.recv() eg. clientsocket.recv(1024) for 1kB.On 7/31/05, Joseph Quigley < [EMAIL PROTECTED]> wrote:Hi Dan, Danny Yoo wrote:>##>clientsocket.recv()>##>>should work better.>>Ok well I tried your examples but they didn

Re: [Tutor] Socket Programming

2005-08-01 Thread Joseph Quigley
Hi Dan, Danny Yoo wrote: >## >clientsocket.recv() >## > >should work better. > > Ok well I tried your examples but they didn't work. I still get: TypeError: recv() takes at least 1 argument (0 given) How can I fix this? ___ Tutor maillist -

Re: [Tutor] Python FTP GUI - Possible project ?

2005-08-01 Thread Kent Johnson
Matt Williams wrote: > Dear List, > > Does anyone know of a Python FTP GUI tool ? Preferably based around > pyGTK+ ? > > I've had a look (Google, vaults of Parnassus, etc.) but haven't found > one. Googling 'python ftp client' gives http://ftpcube.sourceforge.net/ as well as several resources t

Re: [Tutor] Python FTP GUI - Possible project ?

2005-08-01 Thread Andreas Kostyrka
Am Montag, den 01.08.2005, 20:24 +1200 schrieb Liam Clarke: > Hi Matt, > > If you're au fait with pyGTK+, that combined with the ftplib module > syou should be able to build a decent GUI based FTP programme somewhat > easily, although I can guarantee that if you don't know pyGTK+ too > well, you'

Re: [Tutor] Send attachment

2005-08-01 Thread Jorge Louis De Castro
Thanks for the reply   I did try your approach at first but then, Martin Walsh on this mailing list hinted at something way simpler and elegant, a solution that actually adjusts itself to the default mail client of the user.   It consists of creating an .eml file with all the blurb that goes

Re: [Tutor] Python FTP GUI - Possible project ?

2005-08-01 Thread Liam Clarke
May I second the vote for Pythoncard. Although I'm not sure how easily you could represent directories... On 8/1/05, Kristian Rink <[EMAIL PROTECTED]> wrote: Matt Williams schrieb:> Dear List,>> Does anyone know of a Python FTP GUI tool ? Preferably based around> pyGTK+ ?Though just loosely related

Re: [Tutor] Python FTP GUI - Possible project ?

2005-08-01 Thread Kristian Rink
Matt Williams schrieb: > Dear List, > > Does anyone know of a Python FTP GUI tool ? Preferably based around > pyGTK+ ? Though just loosely related to the original post, if you're not completely familiar with pyGTK+, you might want to think about using pythoncard as GUI framework instead. IIRC it

Re: [Tutor] Python FTP GUI - Possible project ?

2005-08-01 Thread Liam Clarke
Hi Matt, If you're au fait with pyGTK+, that combined with the ftplib module syou should be able to build a decent GUI based FTP programme somewhat easily, although I can guarantee that if you don't know pyGTK+ too well, you'll end up having several screen-smashing moments, followed by a zen like

[Tutor] Python FTP GUI - Possible project ?

2005-08-01 Thread Matt Williams
Dear List, Does anyone know of a Python FTP GUI tool ? Preferably based around pyGTK+ ? I've had a look (Google, vaults of Parnassus, etc.) but haven't found one. If there isn't one, then would people consider it a useful project for newbie programmers (like myself). There have often been questi

Re: [Tutor] Is input a Python function or command?

2005-08-01 Thread Nathan Pinno
Just remembered that input is for integers! Oops! Shouldn't have asked! And in_file makes more sense because I'm loading a file with it. - Original Message - From: "Nathan Pinno" <[EMAIL PROTECTED]> To: "Luke P" <[EMAIL PROTECTED]> Cc: "Tutor mailing list" Sent: Sunday, July 31, 2005 8:0

Re: [Tutor] single executable

2005-08-01 Thread Alan G
> http://starship.python.net/crew/theller/moin.cgi/SingleFileExecutable > > that seems to indicate what I want is possible and it is available. While it is possible to build single exe programs its questionable whether the effort involved is worthwhile. Only the very smallest programs can ever be