2009/9/13 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
On Sun, Sep 13, 2009 at 7:27 AM, Rich Lovely wrote:
> 2009/9/13 Lie Ryan :
> > Wayne wrote:
> >>
> > if your data is like this:
> > mylist = [
> >[3, 2, 4, 1],
> >[4, 1, 2, 3],
> >[3, 1, 2, 1],
> >[2, 1, 1, 1],
> >[1, 1, 2, 1],
> > ]
> >
> > you can use zip(*mylist) to transfo
Hi All,
i've started earning python sone months ago (on Google App Engine
unfortunately).
I have some doubts reagrding "import", and have asked a similar
question here months ago, but without finding a solution.
So:
with import i can import modules or single functions. And this is ok.
Then: as
On Sun, Sep 13, 2009 at 1:17 AM, Lie Ryan wrote:
> if you have data like this:
> mylist = [
> [3, 4, 3, 2, 1],
> [2, 1, 1, 1, 1],
> [4, 2, 2, 1, 2],
> [1, 3, 1, 1, 1],
> ]
>
> you can use mylist.sort(key=lambda x: x[0])
You can omit the key parameter completely in this case, unless yo
Lie Ryan wrote:
if you have data like this:
mylist = [
[3, 4, 3, 2, 1],
[2, 1, 1, 1, 1],
[4, 2, 2, 1, 2],
[1, 3, 1, 1, 1],
]
you can use mylist.sort(key=lambda x: x[0])
sorted(mylist, key=lambda x: x[0]) works as well if you need a new list
I have a further question. If I wa
hi Giorgio,
welcome to Python (whether directly or from GAE!) :-) my comments below.
> with import i can import modules or single functions. And this is ok.
not quite true. regardless of whether you use import or from-import,
you're *always* importing (and loading) modules or packages in their
> But for sorting the list with the first element as key, I tried it
using
just mylist.sort() without the lambda, and its working also. Then why
use the lambda?
There is a little difference between those two variations.
Example:
>>> sorted([[1,2],[1,3],[1,1]])
[[1, 1], [1, 2], [1, 3]]
>>> s
On Saturday 12 September 2009, Patrick wrote:
> 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 my server
> launched on their box and if their data from that ap
I want to take two tuples and and print out all the elements in both tuples
Best Weight Loss Program - Click Here!
http://thirdpartyoffers.juno.com/TGL2141/fc/BLSrjpTFoYayK1TMy2HLJuXWZVUVwGcRz3BvRi27bhNCVhUuOvezC0KPl88/
_
Go for it! 8^D
On Sun, Sep 13, 2009 at 7:45 PM, shellc...@juno.com wrote:
> I want to take two tuples and and print out all the elements in both tuples
>
>
> Best Weight Loss Program - Click Here!
> http://thirdpartyoffers.juno.com/TGL2
Please provide a meaningful subject (other than no subject)
shellc...@juno.com wrote:
I want to take two tuples and and print out all the elements in both tuples
Please explain your goals more thoroughly.
A trivial answer to your question is:
tuple1 = (2.3)
tuple2 = (3,4)
print tuple1, t
11 matches
Mail list logo