我有这样的清单.
['February 01,2011 - February 28, 2011', 'March 01,2011 - March 31, 2011']
我想把它转换成
[('February 01,2011 - February 28, 2011'), ('March 01,2011 - March 31, 2011')]
有任何想法吗??
请帮忙!!!
提前致谢!!!
解决方法:
要使用1个元素创建元组,请在括号中附加逗号:
>>> 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',)]