如果我有一个打开的文件,是否有os调用将完整路径作为字符串?
f = open('/Users/Desktop/febROSTER2012.xls')
Run Code Online (Sandbox Code Playgroud)
从f,我怎么得到"/Users/Desktop/febROSTER2012.xls"?
非常直接给你们,但你如何修改%s的输出值?
print "Successfully created the file: %s" % iFile + '.txt'
Run Code Online (Sandbox Code Playgroud)
我尝试使用()的,{}的,但没有什么工作?
iFile是文件的名称,我希望它在显示时以.txt显示.
编辑:
我得到了输出 Successfully created the file: <open file 'test', mode 'rb' at 0x14cef60>.txt