玩蛇网提供最新Python编程技术信息以及Python资源下载!

文中python源码 os.system支持变量吗?

def readHtmlName(dir,filename):
    os.system("ls %s' > %s") % (dir,filename)

>>> readHtmlName("/root/bet/urls","/root/bet/fileNames.txt")
sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in readHtmlName
TypeError: unsupported operand type(s) for %: 'int' and 'tuple'

应该怎么写呢?求指教~

os.system("ls %s > %s" % (dir,filename) )

玩蛇网文章,转载请注明出处和文章网址:https://www.iplaypy.com/wenda/wd19462.html

相关文章 Recommend

玩蛇网Python互助QQ群,欢迎加入-->: 106381465 玩蛇网Python新手群
修订日期:2017年05月18日 - 17时51分10秒 发布自玩蛇网

您现在的位置: 玩蛇网首页 > Python问题解答 > 正文内容
我要分享到:

必知PYTHON教程 Must Know PYTHON Tutorials

必知PYTHON模块 Must Know PYTHON Modules