不確定爲什麼上次打印關閉?請參閱徵求意見的具體問題關於python的拆分的簡單問題
john = ['john doe', 44, 32000]
jane = ['jane doe', 23, 12000]
people = [john, jane]
for p in people:
#===========================================================================
# p[0] prints "john doe" as expected
# p[0].split() prints ['john', 'doe'] as expected
# p[0].split()[0] prints "john" and "jane" as expected
#===========================================================================
for x in p[0].split():
print('--> ', x[0])
# prints "j","d" - not sure why
# expected "john" and "jane"
OMG,我是一個新人。謝謝。不知道我怎麼會錯過這個 – JAM 2011-03-01 03:33:36