Re: [Tutor] whats the best command to end a program

2005-12-07 Thread w chun
> what would be the best command to end a program with. > i have an app that i want to start every day at 6am from cron > but i want it to shutdown at 4pm > > i was going to check by time on every loop > > if int(time.strftime(%H)) > 4: > some

Re: [Tutor] My First Program

2005-12-07 Thread w chun
looks good for your 1st program. some improvements that i can think of: 1. notice how you repeat blocks of code? specifically, i mean: (ask a question, get the answer, validate the answer). since this is all similar code, it's a great place for you to learn what a loop is. that way, you only h

Re: [Tutor] Escaping double quotes

2005-12-07 Thread w chun
> > >>> label = 'this is "quoted"' > > >>> label.replace('"','\"') > > 'this is "quoted"' > > ## This works > > >>> label.replace('"','\'') > > "this is 'quoted'" > > > What I should have been using is label.replace('"','\\"') > :-) Nevermind. hold on a second pardner! :-) what were you t

[Tutor] Escaping double quotes

2005-12-07 Thread Tim Johnson
I must be having a Senior Moment here, but the following baffles me: >>> label = 'this is "quoted"' >>> label.replace('"','\"') 'this is "quoted"' ## This works >>> label.replace('"','\'') "this is 'quoted'" What am I missing here? thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.a

Re: [Tutor] Escaping double quotes

2005-12-07 Thread Tim Johnson
* Tim Johnson <[EMAIL PROTECTED]> [051207 15:56]: > I must be having a Senior Moment here, but the following > baffles me: > >>> label = 'this is "quoted"' > >>> label.replace('"','\"') > 'this is "quoted"' > ## This works > >>> label.replace('"','\'') > "this is 'quoted'" What I should have

[Tutor] My First Program

2005-12-07 Thread Trent Rigsbee
Hi! My first "ever" program that I've created is a simple game called "State Capitals". It's straight forward; 5 simple questions about state capitals in a non-GUI format. Can someone look over my code and offer tips, suggestions, criticism? Also, I'd like to be able to end the program if the us

Re: [Tutor] Run script automatically in IDLE shell

2005-12-07 Thread Alan Gauld
The IDLE documentation (run idle -h) says that idle -r file.py runs the commands in the file. Is that what you are doing? It looks different to your Win98 version. > P.S. I do all this to have accentuated characters (French) correctly > displayed, and this is done in the IDLE Shell, but fail

Re: [Tutor] file permissions

2005-12-07 Thread Alan Gauld
> Looking for easiest way to get a files permissions in linux. > look at the os.stat function. I'm in the middle of documenting its use but you might like to peruse the later sections of the following draft topic http://www.freenetpages.co.uk/hp/alan.gauld/tutos.htm Alan G Author of the lear

Re: [Tutor] file permissions

2005-12-07 Thread Danny Yoo
> > I agree with Danny, the question lacks any evidence of prior > > investigation on the part of the poster, and that makes it a lousy > > candidate for the helpful guidance of the python tutor list. Hi Eric, It there's something I want to avoid, it's the impression that we're looking at each q

Re: [Tutor] smtplib mail header problem

2005-12-07 Thread dave s
On Tuesday 06 December 2005 22:23, Liam Clarke-Hutchinson wrote: > Okay, just checked the docs - > > "sendmail( from_addr, to_addrs, msg[, mail_options, rcpt_options]) > > Note: The from_addr and to_addrs parameters are used to construct the > message envelope used by the transport agents. The SMTP

Re: [Tutor] file permissions

2005-12-07 Thread Gabriel Farrell
On Wed, Dec 07, 2005 at 02:51:55PM -0700, Eric Walker wrote: > After 4+ hours > of playing around with this I made the futile post. Don't let the post be futile! Post what you've tried so far and you'll get help. gsf ___ Tutor maillist - Tutor@p

Re: [Tutor] file permissions

2005-12-07 Thread Eric Walker
Sorry for the bad question. I did google and found the same pages that Danny mentioned. Just couldn't get the stuff to work, or understand what modules needed to be imported to get them to work. I typically use the tutor list as a last resort. After 4+ hours of playing around with this I made th

Re: [Tutor] file permissions

2005-12-07 Thread Gabriel Farrell
On Wed, Dec 07, 2005 at 11:52:20AM -0800, Danny Yoo wrote: > On Wed, 7 Dec 2005, Eric Walker wrote: > > > Looking for easiest way to get a files permissions in linux. > > Hi Eric, > > What have you looked at so far? I agree with Danny, the question lacks any evidence of prior investigation on t

[Tutor] Run script automatically in IDLE shell

2005-12-07 Thread Yann Le Du
Hello, I'd like to have some scripts run directly inside the IDLE shell when I double click on some properly built shortcut, and not inside the DOS window. I've managed to do that under win98, but failed in win2000 and winXP. I dont' want to have to "run module" inside the idle editor, just di

Re: [Tutor] file permissions

2005-12-07 Thread Danny Yoo
On Wed, 7 Dec 2005, Eric Walker wrote: > Looking for easiest way to get a files permissions in linux. Hi Eric, What have you looked at so far? One of the first hits to the Google query "file permission python" comes up with some good information: http://www.faqts.com/knowledge_base/view

[Tutor] file permissions

2005-12-07 Thread Eric Walker
Looking for easiest way to get a files permissions in linux. Thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] regular expressions

2005-12-07 Thread Alan Gauld
> a scientist suggested me to try biopython. This point > is not just with genbank sequences. what will i do if > i have to parse a paragraph for some expression. One thing to watch is that re.match() only checks if the pattern is at the beginning of the line. You should maybe consider using re

Re: [Tutor] regular expressions

2005-12-07 Thread Danny Yoo
On Wed, 7 Dec 2005, ps python wrote: > sorry for repost. awaiting to hear from some members. a scientist > suggested me to try biopython. This point is not just with genbank > sequences. what will i do if i have to parse a paragraph for some > expression. thanks again. Hello, I just want to

Re: [Tutor] cas and python

2005-12-07 Thread Danny Yoo
On Wed, 7 Dec 2005, Cedric BRINER wrote: > does one of you knows if there is a python module which implements > CAS(Central Authentication Service): > https://clearinghouse.ja-sig.org/wiki/display/CAS/Home Hi Cedric, Not certain, but most likely. See: http://www.zope.org/Members/mrlex/AC

Re: [Tutor] (no subject)

2005-12-07 Thread Brian van den Broek
david said unto the world upon 2005-12-03 20:36: > hello again. i think my dig function is working correctly now. > any input on how to save and restore all the rooms and descriptions? > thanks for helping. Hi David, I'm catching up on mail backlog, so I'm a bit late, but I've a suggestion or tw

Re: [Tutor] regular expressions

2005-12-07 Thread Danny Yoo
On Wed, 7 Dec 2005, ps python wrote: > I am a new python learner. i am trying to parse a file using regular > expressions. Hello, Just as an aside: parsing Genbank flat files like this is not such a good idea, because you can get the Genbank XML files instead. For example, your locus NM_005

Re: [Tutor] regular expressions

2005-12-07 Thread ps python
sorry for repost. awaiting to hear from some members. a scientist suggested me to try biopython. This point is not just with genbank sequences. what will i do if i have to parse a paragraph for some expression. thanks again. hi, I am a new python learner. i am trying to parse a file using

Re: [Tutor] to process data from several dictionaries

2005-12-07 Thread Kent Johnson
Andrzej Kolinski wrote: > > Let's forget for the time being my previous topic (files - strings - > lists). As a result of (not only) my efforts I arrived to the point that > I have data I need but I do not know how to process them. Form each > (game) file a dictionary is created containing play

[Tutor] to process data from several dictionaries

2005-12-07 Thread Andrzej Kolinski
Let's forget for the time being my previous topic (files - strings - lists). As a result of (not only) my efforts I arrived to the point that I have data I need but I do not know how to process them. Form each (game) file a dictionary is created containing player names (key) and the scores + board

Re: [Tutor] Read XML

2005-12-07 Thread Joseph Quigley
Joseph Quigley wrote:> How do I read xml? The python documentation doesn't help me. > Or, how can I remove the (tags?) ?If you want to strip out all the tags and just leave the text,Strip-o-Gram might do it. http://www.zope.org/Members/chrisw/StripOGramThere was a thread here recently about other t

[Tutor] cas and python

2005-12-07 Thread Cedric BRINER
hi, does one of you knows if there is a python module which implements CAS(Central Authentication Service): https://clearinghouse.ja-sig.org/wiki/display/CAS/Home thanks in advance Ced. -- Cedric BRINER Geneva - Switzerland ___ Tutor maillist - Tu

[Tutor] regular expressions

2005-12-07 Thread ps python
hi, I am a new python learner. i am trying to parse a file using regular expressions. LOCUS NM_005417 4145 bpmRNA linear PRI 04-DEC-2005 DEFINITION Homo sapiens v-src sarcoma (Schmidt-Ruppin A-2) viral oncogene homolog (avian) (SRC), transcript variant

Re: [Tutor] Exceptions vs. Status Codes

2005-12-07 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi, > > I have a general question regarding programming style which may or may > not have an answer. Is it a better practice to have a function raise > an exception on error, so that the error can be caught; or return a > status code indicating that the function was uns

Re: [Tutor] Exceptions vs. Status Codes

2005-12-07 Thread Alan Gauld
> not have an answer. Is it a better practice to have a function raise > an exception on error, so that the error can be caught; or return a > status code indicating that the function was unsuccessful? Exceptions are nearly always better. For some of the reasons why, see my tutorial topic on Erro

Re: [Tutor] smtplib mail header problem

2005-12-07 Thread w chun
> It has been great for 11ish months, now all my mail is classed as > spam & junked :( dave, i'm a little surprised by this. if your code has been working for almost a year and suddently breaks, that can only be explained by 1 or 2 things: 1. your code was modified 2. the server was modified (