Reputation: 1681
I have a list like this.
['February 01,2011 - February 28, 2011', 'March 01,2011 - March 31, 2011']
I want to convert it to
[('February 01,2011 - February 28, 2011'), ('March 01,2011 - March 31, 2011')]
Any Ideas?? Please help!!! Thanks in advance!!!
Upvotes: 2
Views: 3760
Reputation: 362716
To make a tuple with 1 element, append a comma in the parentheses:
>>> my_list = ['February 01,2011 - February 28, 2011', 'March 01,2011 - March 31, 2011']
>>> [(x,) for x in my_list]
[('February 01,2011 - February 28, 2011',), ('March 01,2011 - March 31, 2011',)]
Upvotes: 13