Re: [Tutor] searching for newlines does not work!

2010-10-23 Thread win...@interchange.ubc.ca
(Hope this reply makes it back to the Tutor list; I didn't see how the list would know this is a reply... I'm trying a reply-all) This is where I say Doh! and Thanks! I realize now where my fuzzy-headedness come from. I generally use re expressions. If these were re search strings, the raw would

Re: [Tutor] searching for newlines does not work!

2010-10-23 Thread Alan Gauld
"Adam Bark" wrote >>> test=r"a \n b \n c \n" >>> test.replace(r"\n","***") 'a *** b *** c ***' >>> test2=""" ... a ... b ... c ... """ >>> test2.replace(r"\n","***") '\na\nb\nc\n' In your first example you put the characters into the string test and replaced the characters. The second exam

Re: [Tutor] Writing Scripts.

2010-10-23 Thread Jack Uretsky
Hi- Python is case sensitive. If you type "IDLE" (without the quotes) in a terminal window (not Idle) you should, after a few seconds, get a separate screen on which to type. Regards, Jack "Trust me. I have a lot of exp

Re: [Tutor] searching for newlines does not work!

2010-10-23 Thread Adam Bark
On 23/10/10 23:03, win...@interchange.ubc.ca wrote: This is driving me batty! In the interactive window, I can use string.replace on newlines for some strings and not for others. Here is what work for newlines: b...@bill-laptop:~$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC

[Tutor] searching for newlines does not work!

2010-10-23 Thread win...@interchange.ubc.ca
This is driving me batty! In the interactive window, I can use string.replace on newlines for some strings and not for others. Here is what work for newlines: b...@bill-laptop:~$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or

Re: [Tutor] Problem Passing VARs to Python from PHP & capturing return string

2010-10-23 Thread Emile van Sebille
On 10/22/2010 11:28 AM Roy Hinkelman said... My script doesn't want to recognize the variables from the exec() command in PHP. Plus, it won't capture the results of the script. This Python script works in IDLE, and I've got some testing code in there. If your python code works and you're havi

Re: [Tutor] What does "TypeError: 'int' object is not iterable"mean?

2010-10-23 Thread Adam Bark
On 23/10/10 13:38, Alan Gauld wrote: "Steven D'Aprano" wrote It would have to be a *very* old version. The use of * as the width parameter in format strings goes back to the Dark Ages of Python 1.5: ... I believe this is a virtual copy of string formatting from C, in which case it probably go

Re: [Tutor] What does "TypeError: 'int' object is not iterable"mean?

2010-10-23 Thread Alan Gauld
"Steven D'Aprano" wrote It would have to be a *very* old version. The use of * as the width parameter in format strings goes back to the Dark Ages of Python 1.5: ... I believe this is a virtual copy of string formatting from C, in which case it probably goes back to the 80s or even the 70s

Re: [Tutor] What does "TypeError: 'int' object is not iterable" mean?

2010-10-23 Thread Richard D. Moores
On Sat, Oct 23, 2010 at 03:43, Dave Angel wrote: > On 2:59 PM, Richard D. Moores wrote: >> >> It's great to have you chime in, Steven. I do wish you would stop >> pulling your punches, however. ;) >> >> On Fri, Oct 22, 2010 at 17:23, Steven D'Aprano >>  wrote: >>> float2n_decimals(x, 3) >>> >>> i

Re: [Tutor] What does "TypeError: 'int' object is not iterable" mean?

2010-10-23 Thread Steven D'Aprano
On Sat, 23 Oct 2010 09:43:07 pm Dave Angel wrote: > On 2:59 PM, Richard D. Moores wrote: [...] > >> float2n_decimals(x, 3) > >> > >> is better written in place as: > >> > >> "%.*f" % (3, x) > >> > >> There's no need for a function for something so simple. > > > > Yes, but I needed one for ("%%.%sf"

Re: [Tutor] problems with numdifftools

2010-10-23 Thread Steven D'Aprano
On Sat, 23 Oct 2010 12:30:59 pm Nicolai Heitz wrote: > Hey, > > I am not sure if you are the right persons to contact but if not I > would appreciate a short notice and maybe an address where I can find > help. I'd try the numpy mailing list: http://www.scipy.org/Mailing_Lists [...] > 5) The He

Re: [Tutor] What does "TypeError: 'int' object is not iterable" mean?

2010-10-23 Thread Dave Angel
On 2:59 PM, Richard D. Moores wrote: It's great to have you chime in, Steven. I do wish you would stop pulling your punches, however. ;) On Fri, Oct 22, 2010 at 17:23, Steven D'Aprano wrote: On Sat, 23 Oct 2010 12:42:50 am Richard D. Moores wrote: So I wrote a function: def float2n_decimals

[Tutor] What does "TypeError: 'int' object is not iterable" mean?

2010-10-23 Thread col speed
> > Message: 7 > Date: Fri, 22 Oct 2010 21:48:29 -0700 > From: "Richard D. Moores" > To: "Steven D'Aprano" > Cc: tutor@python.org > Subject: Re: [Tutor] What does "TypeError: 'int' object is not >iterable" mean? > Message-ID: > > > > > Content-Type: text/plain; charset=UTF-

[Tutor] problems with numdifftools

2010-10-23 Thread Nicolai Heitz
Hey, I am not sure if you are the right persons to contact but if not I would appreciate a short notice and maybe an address where I can find help. I am using Python 2.6 and the following packages: 1) numpy 2) scipy 3) numdifftools I am a physicist and started to use Python 2-3 weeks ago. I