Re: [Tutor] Help with pi and the math module.

2005-09-26 Thread paul brian
it might be a little clearer if you look at sys.modules In the sys module is a useful dictionary called "modules" This dictionary maps all the names of modules we import, to the objects that are those modules. for example (I am only importing pprint to make it easier to read) >>> import sys, pp

Re: [Tutor] Problem with BeautifulSoup

2005-09-26 Thread Kent Johnson
Bernard Lebel wrote: > Hi grouchy, > > I seem to have found the problem. Somehow, it seems BeautifulSoup > doesn't like nested tags of the same name. This seems to be a feature of BS. It seems a bit of a misfeature when applied to XML but anyway...you can configure BS with a set of tags which ca

[Tutor] wxPython problem

2005-09-26 Thread Øyvind
Hello. I have been reading the http://wiki.wxpython.org/index.cgi/Getting_20Started manual and are running the program there. (Enclosed below). When I run it, it works fine. But, when I run it again, I get the error PyNoAppError: The wx.App object must be created first! I assume I have killed the

[Tutor] script question

2005-09-26 Thread Chris Hallman
I needed a script that takes command line arguments, searches an ini file for a match to the arguments and then executes a Windows executable. This is my first script using python so I wanted to make sure I made the most of the language. I took bits and pieces from different tutorials and examples

Re: [Tutor] script question

2005-09-26 Thread Kent Johnson
Chris Hallman wrote: > The script is executed in this > manner: > > python search_interface.py device interface interface_name "is down - > 00:00:00 01/01/06" > > Here is the script: > > import ConfigParser, string, sys > section = sys.argv[1] > port = sys.argv[3] > INI=ConfigParser.ConfigPars

Re: [Tutor] wxPython problem

2005-09-26 Thread Franz Steinh�usler
On Mon, 26 Sep 2005 13:41:32 +0200 (CEST), Øyvind <[EMAIL PROTECTED]> wrote: >Hello. > >I have been reading the >http://wiki.wxpython.org/index.cgi/Getting_20Started manual and are >running the program there. (Enclosed below). > >When I run it, it works fine. But, when I run it again, I get the e

Re: [Tutor] wxPython problem

2005-09-26 Thread Øyvind
Sorry... Forgot all about that. Using WinXP, ActiveState Python 2.3 and wx-version 2.6.1.0. I run it in ActiveStates Interactive Window, which is IDLE (I think). Thanks in advance http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] script question

2005-09-26 Thread Christopher Arndt
Chris Hallman schrieb: > for i in passwordlist: > if i == port: > os.system("d:\\tnd\\bin\\cawto.exe -cat NetNet " + sys.argv[1] + > " " + sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4]) 1) The last line can be also expressed as: os.system(r"d:\tnd\bin\cawto.exe -cat NetNet %s" %

Re: [Tutor] wxPython problem

2005-09-26 Thread Franz Steinh�usler
On Mon, 26 Sep 2005 14:32:53 +0200 (CEST), Øyvind <[EMAIL PROTECTED]> wrote: >Sorry... Forgot all about that. > >Using WinXP, ActiveState Python 2.3 and wx-version 2.6.1.0. > >I run it in ActiveStates Interactive Window, which is IDLE (I think). > >Thanks in advance > > Aha, I thought something

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-26 Thread Nathan Pinno
Bob,   I did what you suggested. Take another look, and tell me if you were a potential customer, would you purchase something?   Why not take the challenge? It's not like I'm asking much.   Nathan Pinno - Original Message - From: bob To: Nathan Pinno Cc: tutor@python

Re: [Tutor] Exception handling - syntaxerror?!

2005-09-26 Thread Andrei
Krishna wrote: > When I have this piece of code in a function, it works fine. So is > this some limitation of directly working out off the console? It is indeed valid Python (you don't have to have empty lines after try-except in a real Python program). > Seems the console supports complete code

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-26 Thread bob
At 10:34 AM 9/26/2005, Nathan Pinno wrote: Bob,   I did what you suggested. Take another look, and tell me if you were a potential customer, would you purchase something?  I tried http://zoffee.tripod.com/purchasecomprogs.htm I got "Sorry but the page ... is not here."   Sorry, but the page or t

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-26 Thread Nathan Pinno
The actual URL is http://zoffee.tripod.com/purchasecompprogs.htm - Original Message - From: bob To: Nathan Pinno Cc: tutor@python.org Sent: Monday, September 26, 2005 11:54 AM Subject: Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?] At 10:34 AM

Re: [Tutor] printing an acronym (fwd)

2005-09-26 Thread Danny Yoo
Forwarding to tutor -- Forwarded message -- Date: Mon, 26 Sep 2005 08:32:02 -0500 From: Jason Massey <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] printing an acronym Something like this: def acro(a): ... b = a.split() ... c = "" ... for d

Re: [Tutor] printing an acronym (fwd)

2005-09-26 Thread Allen John Schmidt, Jr.
Or a shorter version, a=lambda n: "".join([x[0].upper() for x in n.split()]) Then it is just: >>> a('random access memory') 'RAM' Danny Yoo wrote: Forwarding to tutor -- Forwarded message -- Date: Mon, 26 Sep 2005 08:32:02 -0500 From: Jason Massey <[EMAIL PROTECTED]> T

Re: [Tutor] help getting acronym to print?

2005-09-26 Thread Danny Yoo
> > How could I get the following program to output UDP from the user > > entering user datagram protcol or IP if internet protocla was entered? Wait a second. This looks exactly like this question from just a day ago: http://mail.python.org/pipermail/tutor/2005-September/041639.html The a

Re: [Tutor] Tutor Digest, Vol 19, Issue 66

2005-09-26 Thread David Holland
--- [EMAIL PROTECTED] wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, > visit > http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body > 'help' to > [EMAIL PRO

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-26 Thread Adam
Can I have a look at the password program by any chance? Tutor maillist  -   Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] script question

2005-09-26 Thread R. Alan Monroe
> for i in passwordlist: > if i == port: > os.system("d:\\tnd\\bin\\cawto.exe -cat NetNet " + sys.argv[1] + " " + >sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4]) If you don't have duplicates in your list, a "break" after the os.system line might help, because once you've found

Re: [Tutor] script question

2005-09-26 Thread Kent Johnson
Chris Hallman wrote: > Here is the script: > > import ConfigParser, string, sys > section = sys.argv[1] > port = sys.argv[3] > INI=ConfigParser.ConfigParser() > INI.read("interfaces.ini") > passwordentries=[p for p in INI.options(section)] > passwordlist=[INI.get(section, pw) for pw in passwordent

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-26 Thread bob
At 10:56 AM 9/26/2005, Nathan Pinno wrote: The actual URL is http://zoffee.tripod.com/purchasecompprogs.htm I did what you suggested. Take another look, and tell me if you were a potential customer, would you purchase something? No. For one thing I can (if I didn't already have one) buy a "re

Re: [Tutor] script question

2005-09-26 Thread Kent Johnson
Kent Johnson wrote: > *TEST FIRST* Don't optimize until you know it is too slow and you > have a test case that you can time to see if your 'optimizations' are > making it faster. Pardon my shouting :-) Kent ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] Tutor Digest, Vol 19, Issue 82

2005-09-26 Thread sanjay sinha
n\\cawto.exe -cat NetNet " + sys.argv[1] + " " +sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4])I'd like to know if there is a more efficient way to do this and if there isa way to have these functions performed with the least amount of timepossible (the in

Re: [Tutor] Tutor Digest, Vol 19, Issue 82

2005-09-26 Thread sanjay sinha
n\\cawto.exe -cat NetNet " + sys.argv[1] + " " +sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4])I'd like to know if there is a more efficient way to do this and if there isa way to have these functions performed with the least amount of timepossib

[Tutor] encode question!

2005-09-26 Thread 铁石
I am trying to write a stript that extract jpg files from a html I had downloaded.I encounter a problem with a Big5 charset html file.Big5 used in Hongkong ans Taiwan. In this html file there's a jpg names "xvg_h%202.jpg" in vi ,the tag of the image is

[Tutor] 2 questions......novice but not beginner

2005-09-26 Thread Mike Pippin
Please HELP...   First I need to know how to allow the user to search their local drives and directories in order to load a file...or if there are any pre-written opensource functions that will also be well appreciated.. Second I need to know how to render graphics without the windo

Re: [Tutor] encode question!

2005-09-26 Thread Danny Yoo
On Tue, 27 Sep 2005, [GB2312] ��ʯ wrote: > I am trying to write a stript that extract jpg files > from a html I had downloaded.I encounter a problem with > a Big5 charset html file.Big5 used in Hongkong ans Taiwan. > In this html file there's a jpg names "xvg_h%202.jpg" in vi ,the tag