在Python 2.7,我有以下字符串:如何將字符串中的元組轉換爲元組對象?
"((1, u'Central Plant 1', u'http://egauge.com/'),
(2, u'Central Plant 2', u'http://egauge2.com/'))"
我如何轉換這個字符串回元組?我嘗試過使用split
幾次,但它非常混亂,並改爲列表。
所需的輸出:
((1, 'Central Plant 1', 'http://egauge.com/'),
(2, 'Central Plant 2', 'http://egauge2.com/'))
感謝您的幫助提前!
你是如何得到這個字符串的第一個地方?你是否在控制這部分過程?你想解決什麼問題? – 2013-05-14 03:51:44