Re: [Tutor] Sorting 2-d data

2009-09-12 Thread Lie Ryan
Wayne wrote: Hi, I have a set of data that looks something like this: 3, 4, 3, 2, 1 2, 1, 1, 1, 1 4, 2, 2, 1, 2 1, 3, 1, 1, 1 I want to be able to sort it by the first column, keeping the rest of the values in the same position relative to the original: 1, 3, 1, 1, 1 2, 1, 1, 1, 1 3, 4, 3,

Re: [Tutor] How to print the next line in python

2009-09-12 Thread Lie Ryan
ranjan das wrote: Hi, I am new to python and i wrote this piece of code which is ofcourse not serving my purpose: Aim of the code: To read a file and look for lines which contain the string 'CL'. When found, print the entry of the next line (positioned directly below the string 'CL') c

[Tutor] Sorting 2-d data

2009-09-12 Thread Wayne
Hi, I have a set of data that looks something like this: 3, 4, 3, 2, 1 2, 1, 1, 1, 1 4, 2, 2, 1, 2 1, 3, 1, 1, 1 I want to be able to sort it by the first column, keeping the rest of the values in the same position relative to the original: 1, 3, 1, 1, 1 2, 1, 1, 1, 1 3, 4, 3, 2, 1 4, 2, 2, 1, 2

Re: [Tutor] include remote module

2009-09-12 Thread Patrick
Hey Patrick What I great idea. I did not even know about the compile function. Maybe this idea could really work. Imagine if I gave a client a live Linux CD that automatically called this sort of script right after boot up. They could have the absolute most current version of an application from

Re: [Tutor] include remote module

2009-09-12 Thread Rich Lovely
2009/9/12 Patrick : > Strange question. > > Is it possible to include a module that is on another computer? > > I have been day-dreaming about a project that would allow web code to > drive a desktop App. > > Thanks in advance-Patrick > ___ > Tutor ma

Re: [Tutor] include remote module

2009-09-12 Thread Alan Gauld
"Patrick" wrote Is it possible to include a module that is on another computer? Possible provided you can specify the patgh in some way that can be added to sys.path. Or you can read and exec. But whatever you do its extremely dangerous unless the remote computer is under your complete

Re: [Tutor] include remote module

2009-09-12 Thread Patrick Sabin
Maybe something like this helps you to solve your problem: # get code via http, etc. code = """ def blah(): print 'blah' print 'hello' blah() """ compiled_code = compile(code, 'filename', 'exec') exec(compiled_code) This way you could execute some code from a web client, but the client wo

Re: [Tutor] include remote module

2009-09-12 Thread Patrick
Hi Wayne Thanks for your help. I was thinking of the latter but now that I think of it, once you import a module it won't help to modify that module on the fly later anyways, right? I would need to re-import it. Sounds like reading it via http would be simpler. Thanks again-Patrick Wayne wrote:

[Tutor] include remote module

2009-09-12 Thread Patrick
Strange question. Is it possible to include a module that is on another computer? I have been day-dreaming about a project that would allow web code to drive a desktop App. Thanks in advance-Patrick ___ Tutor maillist - Tutor@python.org To unsubs

Re: [Tutor] How to print the next line in python

2009-09-12 Thread Rich Lovely
2009/9/12 Dave Angel : > ranjan das wrote: >> >> Hi, >> >> I am new to python and i wrote this piece of code which is ofcourse not >> serving my purpose: >> >> Aim of the code: >> >> To read a file and look for lines which contain the string 'CL'. When >> found, >> print the entry of the next line

Re: [Tutor] How to print the next line in python

2009-09-12 Thread Dave Angel
ranjan das wrote: Hi, I am new to python and i wrote this piece of code which is ofcourse not serving my purpose: Aim of the code: To read a file and look for lines which contain the string 'CL'. When found, print the entry of the next line (positioned directly below the string 'CL') conti

Re: [Tutor] How to print the next line in python

2009-09-12 Thread ranjan das
Thanks a lot Andre...it is working On Sat, Sep 12, 2009 at 2:17 PM, Andre Engels wrote: > On Sat, Sep 12, 2009 at 10:35 AM, ranjan das > wrote: > > Hi, > > > > I am new to python and i wrote this piece of code which is ofcourse not > > serving my purpose: > > > > Aim of the code: > > > > To rea

Re: [Tutor] How to print the next line in python

2009-09-12 Thread Andre Engels
On Sat, Sep 12, 2009 at 10:35 AM, ranjan das wrote: > Hi, > > I am new to python and i wrote this piece of code which is ofcourse not > serving my purpose: > > Aim of the code: > > To read a file and look for lines which contain the string 'CL'. When found, > print the entry of the next line (posi

[Tutor] How to print the next line in python

2009-09-12 Thread ranjan das
Hi, I am new to python and i wrote this piece of code which is ofcourse not serving my purpose: Aim of the code: To read a file and look for lines which contain the string 'CL'. When found, print the entry of the next line (positioned directly below the string 'CL') continue to do this till