Re: Conversion of List of Tuples

2012-12-04 Thread Neil Cerutti
On 2012-12-04, Hans Mulder wrote: > It's considered bad style to use map it you don't want the list it > produces. > >> There are more ways: >> > from operator import add > reduce(add, a) >> (1, 2, 3, 4) > > There's a built-in that does "reduce(operator.add"; it's called "sum": > sum

Re: Conversion of List of Tuples

2012-12-04 Thread Hans Mulder
On 4/12/12 10:44:32, Alexander Blinne wrote: > Am 03.12.2012 20:58, schrieb subhabangal...@gmail.com: >> Dear Group, >> >> I have a tuple of list as, >> >> tup_list=[(1,2), (3,4)] >> Now if I want to covert as a simple list, >> >> list=[1,2,3,4] >> >> how may I do that? > > Another approach that h

Re: Conversion of List of Tuples

2012-12-04 Thread Alexander Blinne
Am 03.12.2012 20:58, schrieb subhabangal...@gmail.com: > Dear Group, > > I have a tuple of list as, > > tup_list=[(1,2), (3,4)] > Now if I want to covert as a simple list, > > list=[1,2,3,4] > > how may I do that? Another approach that has not yet been mentioned here: >>> a=[(1,2), (3,4)] >>>

Re: Conversion of List of Tuples

2012-12-04 Thread Gary Herron
On 12/03/2012 11:58 AM, subhabangal...@gmail.com wrote: [(1,2), (3,4)] >>> L=[(1,2), (3,4)] >>> >>> [b for a in L for b in a] [1, 2, 3, 4] -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-lis

Re: Conversion of List of Tuples

2012-12-03 Thread Walter Hurry
On Mon, 03 Dec 2012 22:11:40 +, Steven D'Aprano wrote: > On Mon, 03 Dec 2012 13:14:19 -0800, subhabangalore wrote: > >> Thanks. But I am not getting the counter "5posts 0 views"...if >> moderator can please check the issue. > > What counter are you talking about? > > This is an email mailin

Re: Conversion of List of Tuples

2012-12-03 Thread Steven D'Aprano
On Mon, 03 Dec 2012 13:14:19 -0800, subhabangalore wrote: > Thanks. But I am not getting the counter "5posts 0 views"...if moderator > can please check the issue. What counter are you talking about? This is an email mailing list, also copied to the Usenet newsgroup comp.lang.python, and mirrore

Re: Conversion of List of Tuples

2012-12-03 Thread John Gordon
In subhabangal...@gmail.com writes: > Thanks. But I am not getting the counter "5posts 0 views"...if > moderator can please check the issue. I logged in via Google Groups and all the replies were present. What is your question? (This group is not moderated.) -- John Gordon

Re: Conversion of List of Tuples

2012-12-03 Thread subhabangalore
On Tuesday, December 4, 2012 1:28:17 AM UTC+5:30, subhaba...@gmail.com wrote: > Dear Group, > > > > I have a tuple of list as, > > > > tup_list=[(1,2), (3,4)] > > Now if I want to covert as a simple list, > > > > list=[1,2,3,4] > > > > how may I do that? > > > > If any one can kindl

Re: Conversion of List of Tuples

2012-12-03 Thread Chris Angelico
On Tue, Dec 4, 2012 at 7:04 AM, John Gordon wrote: > In <6049bc85-6f8e-429b-a855-ecef47a9d...@googlegroups.com> > subhabangal...@gmail.com writes: > >> Dear Group, > >> I have a tuple of list as, > >> tup_list=[(1,2), (3,4)] >> Now if I want to covert as a simple list, > >> list=[1,2,3,4] > >> ho

Re: Conversion of List of Tuples

2012-12-03 Thread MRAB
On 2012-12-03 20:04, John Gordon wrote: In <6049bc85-6f8e-429b-a855-ecef47a9d...@googlegroups.com> subhabangal...@gmail.com writes: Dear Group, I have a tuple of list as, tup_list=[(1,2), (3,4)] Now if I want to covert as a simple list, list=[1,2,3,4] how may I do that? new_list

Re: Conversion of List of Tuples

2012-12-03 Thread Chris Kaynor
On Mon, Dec 3, 2012 at 11:58 AM, wrote: > Dear Group, > > I have a tuple of list as, > > tup_list=[(1,2), (3,4)] > Now if I want to covert as a simple list, > > list=[1,2,3,4] > > how may I do that? > > If any one can kindly suggest? Googling didn't help much. If you know they are always exactly

Re: Conversion of List of Tuples

2012-12-03 Thread John Gordon
In <6049bc85-6f8e-429b-a855-ecef47a9d...@googlegroups.com> subhabangal...@gmail.com writes: > Dear Group, > I have a tuple of list as, > tup_list=[(1,2), (3,4)] > Now if I want to covert as a simple list, > list=[1,2,3,4] > how may I do that? new_list = [] for t in tup_list: for item in

Conversion of List of Tuples

2012-12-03 Thread subhabangalore
Dear Group, I have a tuple of list as, tup_list=[(1,2), (3,4)] Now if I want to covert as a simple list, list=[1,2,3,4] how may I do that? If any one can kindly suggest? Googling didn't help much. Regards, Subhabrata. -- http://mail.python.org/mailman/listinfo/python-list