我一直在試圖傳遞一個元組到我之前創建的函數,但是,我仍然無法使它工作。 我的目標是傳遞一個包含我想要發現大小並打印出來的路徑+文件形式列表的元組。如何傳遞一個元組到一個python函數
這裏是我的代碼
EXl = ('C:\\vd36e404.vdb','C:\\vd368c03.vdb')
def fileF(EXl):
import os
filesize = os.path.getsize(EXl)
print (filesize);
fileF(EXl)
這些都是錯誤的:
Traceback (most recent call last):
File "C:\Documents and Settings\Administrator\workspace\test1py\testcallMyF.py", line 13, in <module>
fileF(EXl)
File "C:\Documents and Settings\Administrator\workspace\test1py\testcallMyF.py", line 9, in fileF
filesize= os.path.getsize(EXl)
File "C:\Python27\lib\genericpath.py", line 49, in getsize
return os.stat(filename).st_size
TypeError: coercing to Unicode: need string or buffer, tuple found
能滿足我爲什麼(我使用Python 2.7.2)誰能解釋
這就是我一直在尋找的! – nassio 2012-02-05 18:37:45