[Tutor] Fw: Fw: curses

2007-07-13 Thread ALAN GAULD
Following my own advice - Forwarded Message From: ALAN GAULD <[EMAIL PROTECTED]> To: max baseman <[EMAIL PROTECTED]> Sent: Saturday, 14 July, 2007 7:53:43 AM Subject: Re: [Tutor] Fw: curses Max, You need to send questions to the tutor list not just me. Make sure you use Reply All

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread elis aeris
understood. On 7/14/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote: elis aeris wrote: > I actually meant to type send, because the text file is then going to > read by auto it 3, which > has the function send > > I use that function

Re: [Tutor] Platform-independent Excel reader

2007-07-13 Thread Bill Burns
encore jane wrote: > Hi, > > Does anyone know about a good native Excel file reader that is platform > independent? > > Thanks, > > AJ > Take a look at this, it's platform independent and reads excel files :-) http://cheeseshop.python.org/pypi/xlrd Bill

Re: [Tutor] Platform-independent Excel reader

2007-07-13 Thread Dale Pearl
how about google docs? On 7/12/07, encore jane <[EMAIL PROTECTED]> wrote: Hi, Does anyone know about a good native Excel file reader that is platform independent? Thanks, AJ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/l

Re: [Tutor] interpreter restarts

2007-07-13 Thread Luke Paireepinart
Alan Gauld wrote: > "elis aeris" <[EMAIL PROTECTED]> wrote > > >> from a file, i click run from the IDLE interpreter >> > > OK, Thats just normal IDLE behaviour. The Python shell > restarts so your module doesn't pick up any junk lying > around from the previous run. > But there's an

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread Luke Paireepinart
elis aeris wrote: > I actually meant to type send, because the text file is then going to > read by auto it 3, which > has the function send > > I use that functions this way because I have this >

Re: [Tutor] CGI error

2007-07-13 Thread Luke Paireepinart
Darren Williams wrote: > Hi all Smile > > I have a Windows hosting account with lunarpages.com and am having a > bit of trouble with CGI. I have enabled both CGI and Python in the > control panel and made sure the permissions for all my CGI scripts are > set to both readable and executable for

Re: [Tutor] Tutor Digest, Vol 41, Issue 47

2007-07-13 Thread Luke Paireepinart
János Juhász wrote: > > Hi Linden, Hi Janos. The text of your e-mail is tiny. I can't read it. Does this have something to do with HTML formatting, perhaps? People on the list generally prefer plain text, but if it's unavoidable, that's fine. It's just less accessible, and therefore less likely

Re: [Tutor] eyeD3 module installation on XP

2007-07-13 Thread Tino Dai
On 7/13/07, Richard Querin <[EMAIL PROTECTED]> wrote: I'm interested in writing a small app - or attempting to ;) - which will involve using the eyeD3 python module to process id3 tags of a given set of files. There are source downloads as well as downloads for various linux distros, which is f

Re: [Tutor] (no subject)

2007-07-13 Thread Luke Paireepinart
[EMAIL PROTECTED] wrote: > Hello, > Hi, welcome to the list. Please use meaningful subject lines in the future. -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] interpreter restarts

2007-07-13 Thread elis aeris
ohhh, you are the greatest :)) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread elis aeris
I actually meant to type send, because the text file is then going to read by auto it 3, which has the function send I use that functions this way because I have this

Re: [Tutor] Importing question

2007-07-13 Thread Kent Johnson
Dick Moores wrote: > At http://wiki.python.org/moin/SimplePrograms I found this code: > > > import itertools > > def iter_primes(): > # an iterator of all numbers between 2 and +infinity > numbers = itertools.count(2) > > # generate pri

[Tutor] Platform-independent Excel reader

2007-07-13 Thread encore jane
Hi, Does anyone know about a good native Excel file reader that is platform independent? Thanks, AJ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] CGI error

2007-07-13 Thread Darren Williams
Hi all I have a Windows hosting account with lunarpages.com and am having a bit of trouble with CGI. I have enabled both CGI and Python in the control panel and made sure the permissions for all my CGI scripts are set to both readable and executable for all users but I keep getting the same

Re: [Tutor] Importing question

2007-07-13 Thread Dick Moores
At 02:50 PM 7/13/2007, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote in > > > > import itertools > > > > def iter_primes(): > > # an iterator of all numbers between 2 and +infinity > > numbers = itertools.count(2) > > ... > > > It works for me in Win XP, Python 2.5. > > > > Ho

Re: [Tutor] class question

2007-07-13 Thread Tiger12506
Ooops, didn't see Alan's post before I sent this... JS >> Your second way seems to make more sense. And instead of raising the >> error, why not just print it: > > There is a very good reason for this and it's important that you > understand > it to write good code. If you use a print statement,

Re: [Tutor] class question

2007-07-13 Thread Dick Moores
At 03:12 PM 7/13/2007, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote > > > Thanks. You've clarified it for me completely. > > > > Your second way seems to make more sense. > > And instead of raising the error, why not just print it: > >Because that would make the class much less reusa

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread Robert H. Haener IV
elis aeris wrote: > def send(string): > f.write("send( \"%s\"\n' % string )" ) > > > > > f = open ("data.ini") > > send("string is very nice and all those things are pretty cool") > > > > > > this one is wrong, i guess i didn't ask you how to add things after this > > > \"%s\"\n' %

Re: [Tutor] class question

2007-07-13 Thread Tiger12506
> Your second way seems to make more sense. And instead of raising the > error, why not just print it: There is a very good reason for this and it's important that you understand it to write good code. If you use a print statement, you break the benefit of encapsulation. If you were to use tha

[Tutor] Fw: curses

2007-07-13 Thread ALAN GAULD
Returning to the list - Forwarded Message > From: max baseman <[EMAIL PROTECTED]> > To: Alan Gauld <[EMAIL PROTECTED]> > hmm but now i get a error on the same line scr.addch(max_x/2, max_y/ > 2, str(population)[0]) > _curses.error addch() returned ERR Thats because you are writing

Re: [Tutor] interpreter restarts

2007-07-13 Thread Alan Gauld
"Tiger12506" <[EMAIL PROTECTED]> wrote > If you run an already saved file, the shell does not restart. > I am curious why this occurs also. It does it for me, I get a restart banner every time I run a file, saved or not. Alan G ___ Tutor maillist -

Re: [Tutor] time.mktime(time.gmtime(time tuple from any timezone))always will be the same ?

2007-07-13 Thread Alan Gauld
"Arun Kumar PG" <[EMAIL PROTECTED]> wrote > May be a dumb question but I am a bit confused (may be coz working > over 24 > hours for the last couple days:)). so the question is: > > No matter which timezone I am in if i say > time.gmtime(time.mktime(( > datetime.date().timetuple( I will alw

Re: [Tutor] interpreter restarts

2007-07-13 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > from a file, i click run from the IDLE interpreter OK, Thats just normal IDLE behaviour. The Python shell restarts so your module doesn't pick up any junk lying around from the previous run. Alan G. ___ Tuto

Re: [Tutor] class question

2007-07-13 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > Thanks. You've clarified it for me completely. > > Your second way seems to make more sense. > And instead of raising the error, why not just print it: Because that would make the class much less reusable. It would be limited to applications using s

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > def send(string): >f.write("send( \"%s\"\n' % string )" ) > > f = open ("data.ini") > > send("string is very nice and all those things are pretty cool") > > this one is wrong, i guess i didn't ask you how to add things after > this Whats "wrong" abou

Re: [Tutor] interpreter restarts

2007-07-13 Thread Tiger12506
Interesting... This is something very strange. I've been able to reproduce the phenomenon that elis described. Here's how to reproduce the error. 1) Open a new edit window in IDLE 2) type in code - do NOT save 3) Select Run Module from the Run menu 4) Save file when prompted When the IDLE shell

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > how do I input " as part of a string? > > f.write("my "car" has been a great one for me") > > I am trying to write the above lines into a file, including > the " as part of a the single string As you say in the subject the qurstion is how to get a quo

Re: [Tutor] Importing question

2007-07-13 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote in > import itertools > > def iter_primes(): > # an iterator of all numbers between 2 and +infinity > numbers = itertools.count(2) > ... > It works for me in Win XP, Python 2.5. > > However, in trying to dig into the code to understand it, > I

Re: [Tutor] Python on Windows with SSH for Cisco devices

2007-07-13 Thread Andreas Kostyrka
I haven't done anything like that as I don't use Windows for anything serious. But I see basically no problem, as at least some of the packages you've mentioned are portable to marginal OSes like Windows *g* So my tip would be, start implementing, I personally would probably stick to conch for

Re: [Tutor] class question

2007-07-13 Thread Dick Moores
At 12:35 PM 7/13/2007, [EMAIL PROTECTED] wrote: However if you try to withdraw any money after you took out the $25 it would raise the error. The overdrawn function checks if you are in the negatives. Since the balance is checked before the money is taken out, there is no error when you take ou

[Tutor] Python on Windows with SSH for Cisco devices

2007-07-13 Thread Chris Hallman
Has anyone successfully used Python on Windows with SSH connections to Cisco devices? I'm referring to using a Python module (Paramiko, pyssh though not actively developed, Twisted.conch, etc.) and not shelling out via Pexpect (doesn't work on Windows) or Plink. I need to connect to hundreds of Ci

Re: [Tutor] class question

2007-07-13 Thread christopher . henk
However if you try to withdraw any money after you took out the $25 it would raise the error. The overdrawn function checks if you are in the negatives. Since the balance is checked before the money is taken out, there is no error when you take out the $25. If you wan the error to be raised whe

Re: [Tutor] class question

2007-07-13 Thread Dick Moores
At 05:35 AM 7/13/2007, Tiger12506 wrote: > > === > > class BankAccount(object): > >def __init__(self, initial_balance=0): > >self.balance = initial_balance > >def deposit(self, amount): > >self.balance += amount > >def withdraw(self, a

Re: [Tutor] String or Re

2007-07-13 Thread Terry Carroll
On Fri, 13 Jul 2007, Terry Carroll wrote: > Try this: > > for line in infile: >if line.find("10.52.10.11") != -1: > outfile.write(line) No, don't. Alan's solution is much nicer. ___ Tutor maillist - Tutor@python.org http://mail.python.org

Re: [Tutor] interpreter restarts

2007-07-13 Thread elis aeris
from a file, i click run from the IDLE interpreter On 7/14/07, elis aeris <[EMAIL PROTECTED]> wrote: IDLE On 7/14/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > > "elis aeris" <[EMAIL PROTECTED]> wrote > > > why deos the interpreter restarts with this? > > Which interpreter? > Command prompt py

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-13 Thread Dave Kuhlman
On Fri, Jul 13, 2007 at 12:39:40PM +1200, John Fouhy wrote: > On 13/07/07, Dave Kuhlman <[EMAIL PROTECTED]> wrote: > > And, I have a question -- If you look at the example of the > > iterative (non-recursive) generator (the Doubler class), you will > > see that it walks a list, not a tree. That's

Re: [Tutor] interpreter restarts

2007-07-13 Thread elis aeris
IDLE On 7/14/07, Alan Gauld <[EMAIL PROTECTED]> wrote: "elis aeris" <[EMAIL PROTECTED]> wrote > why deos the interpreter restarts with this? Which interpreter? Command prompt python? IDLE? PythonWin? PyCrust? And are you running them line by line manually or is the code in a file? > f = op

Re: [Tutor] String or Re

2007-07-13 Thread Terry Carroll
On Fri, 13 Jul 2007, Que Prime wrote: > I'm working on the following code to read a log file and output lines > containing '10.52.10.10' but am unsure of whether to use a regular > expression or string to achive this. > for line in infile: > if line #contains '10.52.10.10': > outfile.

Re: [Tutor] String or Re

2007-07-13 Thread Alan Gauld
"Que Prime" <[EMAIL PROTECTED]> wrote > I'm working on the following code to read a log file and output > lines > containing '10.52.10.10' but am unsure of whether to use a regular > expression or string to achive this. I tend to only use regex for patterns. If its a fixed string the standard me

Re: [Tutor] interpreter restarts

2007-07-13 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > why deos the interpreter restarts with this? Which interpreter? Command prompt python? IDLE? PythonWin? PyCrust? And are you running them line by line manually or is the code in a file? > f = open("data.ini","w") > > f.write("yeahppe") > > f.close()

[Tutor] time.mktime(time.gmtime(time tuple from any timezone)) always will be the same ?

2007-07-13 Thread Arun Kumar PG
Guys, May be a dumb question but I am a bit confused (may be coz working over 24 hours for the last couple days:)). so the question is: No matter which timezone I am in if i say time.gmtime(time.mktime(( datetime.date().timetuple( I will always get the same value. - right ? thx for answer

Re: [Tutor] interpreter restarts

2007-07-13 Thread Terry Carroll
On Sat, 14 Jul 2007, elis aeris wrote: > why deos the interpreter restarts with this? > > f = open("data.ini","w") > > f.write("yeahppe") > > f.close() Not sure. It certainly doesn't, for me. >>> f = open("data.ini","w") >>> f.write("yeahppe") >>> f.close() >>> U:\>cat data.ini yeahppe _

Re: [Tutor] Question

2007-07-13 Thread Alan Gauld
"Luke Paireepinart" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> Try >> >> tfile.write(str(i)+'\n') >> >> OR >> >> tfile.write( "d\n" % i) > Alan meant tfile.write("%d\n" % i) of course ;) Which is why we should always include the list on replies! Thanks for catching that o

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread elis aeris
def send(string): f.write("send( \"%s\"\n' % string )" ) f = open ("data.ini") send("string is very nice and all those things are pretty cool") this one is wrong, i guess i didn't ask you how to add things after this \"%s\"\n' % title) ___

[Tutor] String or Re

2007-07-13 Thread Que Prime
I'm working on the following code to read a log file and output lines containing '10.52.10.10' but am unsure of whether to use a regular expression or string to achive this. Can someone please enlighten me? Thank you. infile = open("in.txt","r") outfile = open("out.txt", "w") for line in infil

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread Robert H. Haener IV
elis aeris wrote: > def winlist(title): > f.write("winlist(\"title\")") > > > > how about if "title" is a variable? I assume, from your example, that you want to write the value of the variable 'title' enclosed in quotation marks. We once again use an escape sequence to output quotation

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread Robert H. Haener IV
elis aeris wrote: > this one doesn't work; did I misread your string? > > f = open("data.ini","w") > > title = "taitle" > > f.write('title is \"%title\"\n ') > > > f.close() Yes, you misread my string. The correct form of the above would be as follows: f = open("data.ini","w") title = "tai

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread elis aeris
this one doesn't work; did I misread your string? f = open("data.ini","w") title = "taitle" f.write('title is \"%title\"\n ') f.close() ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread elis aeris
def winlist(title): f.write("winlist(\"title\")") how about if "title" is a variable? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] interpreter restarts

2007-07-13 Thread elis aeris
why deos the interpreter restarts with this? f = open("data.ini","w") f.write("yeahppe") f.close() ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread Robert H. Haener IV
Tom Tucker wrote: > Try escaping the quotes. > f = open("data.ini","w") f.write("my \"car\" has been a great one for me") f.close() > > ~ >cat data.ini > my "car" has been a great one for me Tom beat me to posting that, see here for more information on escape sequences in Python:

Re: [Tutor] class question

2007-07-13 Thread Tiger12506
> === > class BankAccount(object): >def __init__(self, initial_balance=0): >self.balance = initial_balance >def deposit(self, amount): >self.balance += amount >def withdraw(self, amount): >self.balance -= amount >def overdr

Re: [Tutor] (no subject)

2007-07-13 Thread Tiger12506
If you just draw rectangles, you would have to track the mouse cursor and check to see if it's within the boundaries of a rectangle manually. I suggest using buttons. It will be easier to know when the mouse is over them. > Hello, > >The attached code makes a number of colored rectangles vi

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread Tom Tucker
Try escaping the quotes. f = open("data.ini","w") f.write("my \"car\" has been a great one for me") f.close() ~ >cat data.ini my "car" has been a great one for me On 7/13/07, elis aeris <[EMAIL PROTECTED]> wrote: also, why does the interpreter restart when I run this? f = open("data.ini"

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread elis aeris
also, why does the interpreter restart when I run this? f = open("data.ini","w") f.write("yeahppe") f.close() ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] how do I input " as part of a string?

2007-07-13 Thread elis aeris
how do I input " as part of a string? f.write("my "car" has been a great one for me") I am trying to write the above lines into a file, including the " as part of a the single string how do I do that? ___ Tutor maillist - Tutor@python.org http://mai

Re: [Tutor] curses

2007-07-13 Thread Mike Hansen
> > ok after reading a few tutorials i think i know enough to write my > program > here it is > not commented yet though sorry: > For me, I need to put comments in while I'm coding or I'll never put them in. I _try_ to put in a doc string for every class and function/method. With Python being

[Tutor] class question

2007-07-13 Thread Dick Moores
on http://wiki.python.org/moin/SimplePrograms I found this code: === class BankAccount(object):     def __init__(self, initial_balance=0):     self.balance = initial_balance     def deposit(self, amount):     self.balance += amount     def withdraw(sel

Re: [Tutor] Importing question

2007-07-13 Thread Dick Moores
At 07:55 AM 7/13/2007, Eric Brunson wrote: >Dick Moores wrote: >>At http://wiki.python.org/moin/SimplePrograms I found this code: >> >> >>import itertools >> >>def iter_primes(): >> # an iterator of all numbers between 2 and +infinity >> numbers

Re: [Tutor] Importing question

2007-07-13 Thread Eric Brunson
Dick Moores wrote: > At http://wiki.python.org/moin/SimplePrograms I found this code: > > > import itertools > > def iter_primes(): > # an iterator of all numbers between 2 and +infinity > numbers = itertools.count(2) > > # generate primes

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-13 Thread Eric Brunson
Dave Kuhlman wrote: > I find iterators and generators fascinating. So, in order to try > to understand them better myself, I've written up some notes. I'm > hoping that these notes might help someone new to the generators > and iterators in Python. You can find it here: > > http://www.rexx.c

[Tutor] eyeD3 module installation on XP

2007-07-13 Thread Richard Querin
I'm interested in writing a small app - or attempting to ;) - which will involve using the eyeD3 python module to process id3 tags of a given set of files. There are source downloads as well as downloads for various linux distros, which is fine. However I also might want to work on this in XP. I'm

Re: [Tutor] Question about code reviews

2007-07-13 Thread Tino Dai
On 7/12/07, Tiger12506 <[EMAIL PROTECTED]> wrote: >> >> > Do you know of any service or person that could do a code review >> > for me? >> >> Perhaps if you were more specific about what you are looking for in the >> review? If you merely want something to check your code for possible >> er

Re: [Tutor] Tutor Digest, Vol 41, Issue 47

2007-07-13 Thread János Juhász
Hi Linden, > Date: Fri, 13 Jul 2007 09:05:38 + (GMT) > From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > Subject: [Tutor] (no subject) > To: tutor@python.org > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="utf-8" > The functionalities I am trying to implement for this

[Tutor] Importing question

2007-07-13 Thread Dick Moores
At http://wiki.python.org/moin/SimplePrograms I found this code: import itertools def iter_primes(): # an iterator of all numbers between 2 and +infinity numbers = itertools.count(2) # generate primes forever while True: #

[Tutor] (no subject)

2007-07-13 Thread [EMAIL PROTECTED]
Hello, The attached code makes a number of colored rectangles visible in a canvas. Each rectangle should match with a pre-recorded sound file (in .wav or other format) containing the pronunciation of a letter of the alphabet in a given language. For instance, the first rectangle, in white,

Re: [Tutor] Question

2007-07-13 Thread Luke Paireepinart
> Try > > tfile.write(str(i)+'\n') > > OR > > tfile.write( "d\n" % i) Alan meant tfile.write("%d\n" % i) of course ;) -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor