Thursday 15 March 2012

How to take a python list index containing multiple strings and split it -


I'm looking at some help partitions with a list that has many values ​​and create a new list with different values Are there. [<1> 2] 4, 5, 5)

I need to split a single list into a new list of several indices that:

  L_Revised = [1, 2, 2, 3, 4, 4, 5, 5] & gt; & Gt; L [0] 1   

Which code can I use for it to be able to manipulate individual indices? Thanks for any help!

For a generalized case, where the list may have more than one taple, You can flatten this way:

  & gt; & Gt; & Gt; L = [(1, 2, 3, 4, 5)]> gt; & Gt; & Gt; [Items in the item for a tup in the item] [1, 2, 3, 4, 5]   

But if this is a single Tupal element list, then the other answer is probably easy. / P>

No comments:

Post a Comment