我一直在试图传递一个元组到我之前创建的函数,但是,我仍然无法使它工作。 我的目标是传递一个包含我想要发现大小并打印出来的路径+文件形式列表的元组。如何传递一个元组到一个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