python輸出的結果為
[' "further update is anticipated"', ' "reprocessed"', ' ' (65.0812475944934, 77.7497163153283, 93.4077589098503, 78.2279065705557)', '(39.8413328799098, 50.0752988745116, 49.9953294631081, 39.7845494675869)', ' "2009-01-01" ']
如何分別得到65.0812475944934, 77.7497163153283, 93.4077589098503, 78.2279065705557
39.8413328799098, 50.0752988745116, 49.9953294631081, 39.7845494675869和2009-01-01
謝謝大家啦!
uj5u.com熱心網友回復:
當成二維陣列來讀就可以了list1 = ['c', 'b', (123, 234, 345), (567, 678, 789), '2009-01-01']
print(list1[2][0], list1[2][1], list1[4])
uj5u.com熱心網友回復:
抱歉,沒仔細看。用下面這個吧
list1 = [' "further update is anticipated"', ' "reprocessed"', ' (65.0812475944934, 77.7497163153283, 93.4077589098503, 78.2279065705557)', '(39.8413328799098, 50.0752988745116, 49.9953294631081, 39.7845494675869)', ' "2009-01-01" ']
a = ''.join([x for x in list1[2] if x != '(' and x != ')'and x != ' ']).split(',')
print(a[0], a[1])
b = ''.join([x for x in list1[4] if x != '"'])
print(b)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/21461.html
