在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Python  HTML/ python2.7 set與list 互相轉(zhuǎn)換

python2.7 set與list 互相轉(zhuǎn)換

>>> l3
set([2])
>>> l3=list(l3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable
>>> l3=list(l3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable
>>> l3
set([2])

我看網(wǎng)上python set 可以轉(zhuǎn)換list 但是我這個怎么不行呢?謝謝

回答
編輯回答
吢丕

你的代碼是什么?

>>> I3=set([2])
>>> I3=list(I3)
>>> print(I3)
[2]

如果是上面這樣的,它是沒錯的

'list' object is not callable

可能的原因是你定義了一個變量叫l(wèi)ist, 把系統(tǒng)的關(guān)鍵字覆蓋了
試試

>>> print(type(list))
<class 'type'>
2017年12月5日 15:41
編輯回答
她愚我

感謝上面的答主

2017年3月27日 19:48