How to unpack a list?

When extracting data from a list this way

line[0:3], line[3][:2], line[3][2:]

I receive an array and two variables after it, as should be expected:

(['a', 'b', 'c'], 'd', 'e')

I need to manipulate the list so the end result is

('a', 'b', 'c', 'd', 'e')

How? Thank you.

P.S. Yes, I know that I can write down the first element as line[0], line[1], line[2], but I think that's a pretty awkward solution.

Answers


from itertools import chain
print tuple(chain(['a', 'b', 'c'], 'd', 'e'))

Output:

('a', 'b', 'c', 'd','e')

Need Your Help

MySQL - combining two records, different fields from each record

mysql merge selection records

I am updating an existing database to simplify it and extend its functionality. I have a table as follows:

Retreving Google Calendar Events using GAS

google-apps-script google-calendar

Am trying to get all the events in my calendar and i come up with the below code. But the problem is am getting only one event from the calender.(i.e, event which is nearby). can someone please hel...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.