Conversion from GFA Basic to Python for SpeedTest

2002-04-08 Thread Ed Hopkins
Hi, I'm new to Python and am very impressed with it. Unfortunately I am not yet at the stage where I can convert the GFA Basic code below into Python. Can anyone help please? Any response appreciated and will certainly help me to understand more about Python. BTW This is not a challenge to Py

Re: How to remove a newline character

2002-04-08 Thread Noah Spurrier
Yes indeed. I didn't think of list comprehensions until after I sent the response. That syntax is still new to me -- I only wrote my first list comprehension a month ago! It is a much more clear and Pythonic syntax. I wish that answer had come to my mind first, but I've still got map and lambda o

Donald Hagan/KC-CORPSVC/KC/FRS is out of the office.

2002-04-08 Thread don.g.hagan
I will be out of the office starting 04/08/2002 and will not return until 04/10/2002. ___ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: why do i need to surround file names in inputs with quotes?

2002-04-08 Thread Jeff Shannon
Tom Churm wrote: > i've found & adapted the following simple python script that copies one text > file to another text file. the script works o.k., but only when i enter the > name of the text file (both original, and the name of the new text file) > surrounded by "double quotes". > > i don't

RE: why do i need to surround file names in inputs with quotes?

2002-04-08 Thread Joseph Youngquist
I'm a newbi too, but I think I read that input is for integers and rawinput is for strings...might help Joe Youngquist -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Tom Churm Sent: Monday, April 08, 2002 10:57 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED

RE: why do i need to surround file names in inputs with quotes?

2002-04-08 Thread Michael Robin
Input evaluates the input string that the user enters, which you don't want here. Try using raw_input. mike --- >From the docs: input([prompt]) Equivalent to eval(raw_input(prompt)). Warning: This function is not safe from user errors! It expects a valid Python expression as inpu

Re: ActivePython 2.2 released!

2002-04-08 Thread Trent Mick
Bob, I have add a bug for this here: http://bugs.activestate.com/ActivePython/show_bug.cgi?id=19420 Thank you. We will look into this as soon as we can. Sincerely, Trent [Bob Kline wrote] > On Mon, 1 Apr 2002, David Ascher wrote: > > > - We've made some changes to the Python Package M

Donald Hagan/KC-CORPSVC/KC/FRS is out of the office.

2002-04-08 Thread don.g.hagan
I will be out of the office starting 04/08/2002 and will not return until 04/10/2002. ___ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: How to remove a newline character

2002-04-08 Thread Jeff Shannon
Noah Spurrier wrote: > You want to use map and lamdda. This works on your list: > map(lambda x: x.replace('\n',''), MyList) Why not list comprehensions? Most places where map/filter and lambda are used, a list comp is easier and clearer (and usually faster): MyList = [x.replace('\n','') for x

why do i need to surround file names in inputs with quotes?

2002-04-08 Thread Tom Churm
hi, i've found & adapted the following simple python script that copies one text file to another text file. the script works o.k., but only when i enter the name of the text file (both original, and the name of the new text file) surrounded by "double quotes". i don't understand why this is.

Re: How to remove a newline character

2002-04-08 Thread Noah Spurrier
You want to use map and lamdda. This works on your list: map(lambda x: x.replace('\n',''), MyList) Also remember that Strings have their own replace method, so if you don't really need to do a regular expression substitution then String.replace() is faster. I always thought lambda expression were