首页 > [os.system]支持变量不?

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

【热门文章】
【热门文章】