1
我原本是通過Python 2.7放入這段代碼,但因爲工作需要移植到Python 3.x。我一直在試圖弄清楚如何讓這個代碼在Python 3.2中工作,沒有運氣。Python 3.2 TypeError - 無法弄清楚它是什麼意思
import subprocess
cmd = subprocess.Popen('net use', shell=True, stdout=subprocess.PIPE)
for line in cmd.stdout:
if 'no' in line:
print (line)
我得到這個錯誤
if 'no' in (line):
TypeError: Type str doesn't support the buffer API
誰能給我一個答案,爲什麼這是和/或一些文檔閱讀?
非常感謝。
非常有趣,非常感謝。現在可以多讀一點字節了。 – user2105764 2013-02-26 03:11:42