[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'

应该怎么写呢?求指教~

阅读 10k
1 个回答

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏