Re: [Tutor] Extract lines from a multinile string

2007-10-09 Thread John Fouhy
On 10/10/2007, Eli Brosh <[EMAIL PROTECTED]> wrote: > > > Hello > I have a multiline string such as: > s='''This is the first line > This is the second line > This is the third longer line''' > > Note that s has no control character such as \n. Did you check that? >>> s = '''This is the first lin

[Tutor] Extract lines from a multinile string

2007-10-09 Thread Eli Brosh
Hello I have a multiline string such as: s='''This is the first line This is the second line This is the third longer line''' Note that s has no control character such as \n. The lines are defined as in "natural" writing. How can I extract from s, several strings, each of which is a line from t

[Tutor] Exceptions: Logging TB and local variables?

2007-10-09 Thread Allen Fowler
Hi, My code looks like this: for item in bigset: self.__sub1(item) self.__sub2(item) self.__sub3(item) # the subX functions, in turn, use various 3rd party modules. Now, I would like to do this: for item in bigset: try: self.__sub1(item) self.__sub2(item)

Re: [Tutor] Finding a project

2007-10-09 Thread wormwood_3
When I started out (not long ago), I started working on projects I had the need for. I have done a lot of small sysadmin projects, and they have all been things I found I needed or would help me doing sysadmin work. Try to think of tasks you have to often do that are at all subject to automati

Re: [Tutor] Fwd: Permission Report

2007-10-09 Thread Kent Johnson
Stephen Nelson-Smith wrote: > But if I want to run the same procedure on a remote host, and store > the results in a dictionary so they can be compared, what would I do? What kind of access do you have to the remote host? If you have filesystem access you can use the same program running locally.

[Tutor] Finding a project

2007-10-09 Thread Eric Lake
What is a good way to find a project to work on? I really want to work on something but I can not think of anything useful to write. I am interested in sysadmin stuff (backups, monitoring, etc). That being said I don't really have experience writing apps like that. But I really want to learn. --

Re: [Tutor] Missing LOTS of list messages

2007-10-09 Thread Alan Gauld
"wormwood_3" <[EMAIL PROTECTED]> wrote > I just discovered again that I am missing lots of messages from the > list. > Has anyone else experienced this? > I am using Yahoo! Mail, I use the gmane news interface rather than email but when people reply to me I get the replies via email at my Yaho

Re: [Tutor] Sqrt on a variable

2007-10-09 Thread Ian Witham
On 10/9/07, samir amassine <[EMAIL PROTECTED]> wrote: > > hello, > i can't seem to use the sqrt function on a variable, do you know how i > can??? > i want to make the ABC formula > > Samir > Hi Samir, You could import sqrt from the math module OR, you can do it without importing anything by rai

Re: [Tutor] os.rename anomaly in Python 2.3 on Windows XP

2007-10-09 Thread Tony Cappellini
Thanks. Unfortunately,os.listdir() returns the same string as glob.glob, for the problem file I mentioned. When I pass that string to os.rename() OSError: [Errno 22] Invalid argument > Sounds like it has something to do with Unicode. > Your filenames aren't being interpreted correctly. Perhaps

Re: [Tutor] Increase speed

2007-10-09 Thread Michael Langford
You don't know what's slow. This is the perfect tool for a profiler. http://docs.python.org/lib/profile.html --Michael On 10/9/07, Øyvind <[EMAIL PROTECTED]> wrote: > > Hello. > > I have written a simple application that does a number of simple > calculations. In psudo-code it looks somethi

Re: [Tutor] Missing LOTS of list messages

2007-10-09 Thread bhaaluu
On 10/9/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Maybe you should try Gmail? > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor I think Gmail is a very good idea for mailing lists. 1. You get over 2.8GB

Re: [Tutor] Missing LOTS of list messages

2007-10-09 Thread Kent Johnson
wormwood_3 wrote: > Hello tutors, > > I just discovered again that I am missing lots of messages from the list. > > Has anyone else experienced this? I am using Yahoo! Mail, not sure if > anyone experiences the same with other services... I dunno about regular Yahoo! Mail, but the mail forwardin

[Tutor] Missing LOTS of list messages

2007-10-09 Thread wormwood_3
Hello tutors, I just discovered again that I am missing lots of messages from the list. Compared to this: http://www.nabble.com/Updating-MySQL-Database-t4585380.html where 8 messages are listed, my email client shows 5. They are not in spam, I just never got them. Since this is the third time I

Re: [Tutor] Increase speed

2007-10-09 Thread Alan Gauld
"Øyvind" <[EMAIL PROTECTED]> wrote > Does anyone have any suggestions of what I should do? Your pseudo code is a bit too pseudo to be useful for performance tuning. > class start: You don;t really need a class here, somple functions will suffice but won't make much difference to speed. >f

Re: [Tutor] print question

2007-10-09 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dick Moores wrote: >> return "%02d:%02d:%5.2f" % (hours, minutes, seconds) > > Try %05.2f > > The leading 0 is a 'conversion flag' that specifies zero-padding. Sorry I should have included that in my post but I ass

Re: [Tutor] Increase speed

2007-10-09 Thread Eric Brunson
Øyvind wrote: > Hello. > > I have written a simple application that does a number of simple > calculations. In psudo-code it looks something like below. > > The program works fine. However, it seems like I need a supercomputer to > finish the resultwithin a reasonable timeframe, as the var.txt cont

Re: [Tutor] Sqrt on a variable

2007-10-09 Thread Ken Oliver
From: samir amassine <[EMAIL PROTECTED]> Subject: [Tutor] Sqrt on a variable hello, i can't seem to use the sqrt function on a variable, do you know how i can???i want to make the ABC formulaSamir**I am guessing a

Re: [Tutor] Sqrt on a variable

2007-10-09 Thread Luke Paireepinart
samir amassine wrote: > hello, > i can't seem to use the sqrt function on a variable, do you know how i > can??? > i want to make the ABC formula > > Samir Samir - Next time you ask the list a question, please include some information about what you've already tried and why you think it didn't wo

Re: [Tutor] Increase speed

2007-10-09 Thread Kent Johnson
Øyvind wrote: > Hello. > > I have written a simple application that does a number of simple > calculations. In psudo-code it looks something like below. I think this is the first time I have ever been asked to optimize code without looking at the code! It's hard to optimize pseudo-code. Can you

Re: [Tutor] print question

2007-10-09 Thread Dick Moores
At 03:37 AM 10/9/2007, Kent Johnson wrote: >Dick Moores wrote: >> return "%02d:%02d:%5.2f" % (hours, minutes, seconds) > >Try %05.2f > >The leading 0 is a 'conversion flag' that specifies zero-padding. Huh. Thought I'd tried that. Guess not. Thanks, Kent! ___

[Tutor] Sqrt on a variable

2007-10-09 Thread samir amassine
hello, i can't seem to use the sqrt function on a variable, do you know how i can???i want to make the ABC formulaSamir _ Probeer Live.nl Probeer Live.nl: zoekmachine van de makers van MSN! ___

Re: [Tutor] print question

2007-10-09 Thread Kent Johnson
Dick Moores wrote: > return "%02d:%02d:%5.2f" % (hours, minutes, seconds) Try %05.2f The leading 0 is a 'conversion flag' that specifies zero-padding. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Increase speed

2007-10-09 Thread Øyvind
Hello. I have written a simple application that does a number of simple calculations. In psudo-code it looks something like below. The program works fine. However, it seems like I need a supercomputer to finish the resultwithin a reasonable timeframe, as the var.txt contains a lot of variables th

Re: [Tutor] os.rename anomaly in Python 2.3 on Windows XP

2007-10-09 Thread Tim Golden
Tony Cappellini wrote: > Using Windows XP, SP2 and Python 2.3 > > I've written a script which walks through a bunch of directories and > replaces characters which are typically illegals as filenames, with an > '_' character. [...] > When my script encounters a directory with the unwanted charact

Re: [Tutor] print question

2007-10-09 Thread Dick Moores
At 12:58 AM 10/9/2007, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote > > > return "%02d:%02d:%2.2f" % (hours, minutes, seconds) > > > print secsToHMS(4.04987) --> 00:00:4.05 (I wanted 00:00:04.05) > > > > I don't see how to get 00:00:04.05 using %f . > >

Re: [Tutor] print question

2007-10-09 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > return "%02d:%02d:%2.2f" % (hours, minutes, seconds) > print secsToHMS(4.04987) --> 00:00:4.05 (I wanted 00:00:04.05) > > I don't see how to get 00:00:04.05 using %f . > is as > clear as m