[Tutor] Converting a numpy matrix to a numpy array

2011-03-30 Thread David Crisp
Hello, I have a very simple question / problem I need answered.  The problem is imnot entirely sure of the correct terminology and langauge to use to describe it.  (One of the reasons im using this miling list) I have a 2d matrix representing the X the Y and the Z value of a point.  I wish to con

Re: [Tutor] Trajectory Syntax Error

2011-03-30 Thread Alan Gauld
"Carla Jenkins" wrote When I try using trajectory I receive an error. What is trajectory? Its not a standard Python function so we can't be too helpful in fixing errors unless we know more about it. Here is the code: def logistic(x): return 4*x*(1-x) This is OK so far... ds_l

Re: [Tutor] Regex question

2011-03-30 Thread Andrés Chandía
Thanks Steve, your are, from now on, my guru this is the final version, the good one! contents = re.sub(r'(|)(l|L|n|N|t|T)(|)', r"\2'" ,contents) On Wed, March 30, 2011 17:27, Steve Willoughby wrote: On 30-Mar-11 08:21, "Andrés Chandía" wrote: > > > Thanks Kushal and Steve. > I think it w

Re: [Tutor] Regex question

2011-03-30 Thread Steve Willoughby
On 30-Mar-11 08:21, "Andrés Chandía" wrote: Thanks Kushal and Steve. I think it works,a I say "I think" because at the results I got a strange character instead of the letter that should appear this is my regexp: contents = re.sub(r'(|)(l|L|n|N|t|T)(|)', '\2\'' ,contents) Remember that \2 i

Re: [Tutor] Regex question

2011-03-30 Thread Andrés Chandía
Thanks Kushal and Steve. I think it works,a I say "I think" because at the results I got a strange character instead of the letter that should appear this is my regexp: contents = re.sub(r'(|)(l|L|n|N|t|T)(|)', '\2\'' ,contents) this is my input file content: lomo  nomo  tomo  Lomo  Nomo 

Re: [Tutor] Trajectory Syntax Error

2011-03-30 Thread Emile van Sebille
On 3/30/2011 7:26 AM Carla Jenkins said... I am new to Python learnig for a class. When I try using trajectory I receive an error. Here is the code: def logistic(x): return 4*x*(1-x) ds_logistic11=trajectory(logistic,0.11) SyntaxError: invalid syntax Hi Carla, Be sure to copy and

[Tutor] Trajectory Syntax Error

2011-03-30 Thread Carla Jenkins
I am new to Python learnig for a class. When I try using trajectory I receive an error. Here is the code: def logistic(x): return 4*x*(1-x) ds_logistic11=trajectory(logistic,0.11) SyntaxError: invalid syntax Sincerely, Carla Jenkins ___ Tutor

Re: [Tutor] (no subject)

2011-03-30 Thread Kushal Kumaran
2011/3/30 "Andrés Chandía" : > > > I'm new to this list, so hello everybody!. > Hello Andrés > The stuff: > > I'm working with > regexps and this is my line: > > contents = re.sub("l<\/u>", > "le" ,contents) > > in perl there is a way to reference previous registers, > i.e. > > $text =~ s/(l|L|n|

Re: [Tutor] Regex question

2011-03-30 Thread Steve Willoughby
On 29-Mar-11 23:55, Alan Gauld wrote: ""Andrés Chandía"" wrote in perl there is a way to reference previous registers, $text =~ s/(l|L|n|N)<\/u>/$1e/g; I'm looking for the way to do it in python If you're using just a straight call to re.sub(), it works like this: text = re.sub(r

Re: [Tutor] Grouping based on attributes of elements in a List

2011-03-30 Thread Peter Otten
ranjan das wrote: > I have the following list > > List=[( 'G1', 'CFS', 'FCL', 'R1' ),('G3', 'LOOSEFREIGHT', 'MIXEDLCL', > 'R9'), > ('G4', 'CFS', 'FCL', 'R10' ), ('G2', 'LOOSEFREIGHT', 'LCL', 'R4' ), > ('G1', > 'CFS', 'FCL', 'R2' ), ('G2', 'LOOSEFREIGHT', 'LCL', 'R5') ] > > > now I want to gro

Re: [Tutor] Grouping based on attributes of elements in a List

2011-03-30 Thread Rafael Durán Castañeda
You are right, lambda lis: lis[1:3] would be more readable 2011/3/30 Sander Sweers > On 30 March 2011 00:30, Alan Gauld wrote: > > Wouldn't you just return a tuple of the two elements? > > > > Or am I missing something having jumped into the middle of the thread... > > Ah yes, you are correct.

[Tutor] Regex question

2011-03-30 Thread Alan Gauld
""Andrés Chandía"" wrote I'm new to this list, so hello everybody!. Hi, welcome to the list. Please do not use reply to start a new thread it confuses threaded readers and may mean you message will not be seen. Also please supply a meaningful subject (as above) so we can decide if it looks