问题
I trying to write simple code that execute os command with parameters
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
target = "i586"
build = os.system('/usr/bin/hsh --target="target"')
But it always start as /usr/bin/hsh --target=target instead of target=i586. Also subprocess.call not working cause python too old.
Please help me.
回答1:
build = os.system('/usr/bin/hsh --target="%s"' % target)
or
build = os.system('/usr/bin/hsh --target="' + target + '"')
来源:https://stackoverflow.com/questions/9768529/os-system-old-python-and-arguments-with-parameters