Python 代码作为参数

标签 python arguments

如何将一段代码作为参数传递给python?

我这样试过,但是没用。

$ python3 'print("hello world")'

无法打开文件 'print(hello': [Errno 2] No such file or directory

最佳答案

python -c 'print("hello world")'

关于Python 代码作为参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6006322/

相关文章:

使用多线程 + 多处理的 Python 日志记录

python - 如何根据 URL 列表制作嵌套字典?

Python:Reduce() 和函数作为函数的参数

variables - 如何在 Gradle 脚本中从 Bamboo 访问变量?

windows - CMD/windows 批处理 : how to pass a double quote and a larger than sign in a command argument?

shell - 获取传递给 shell 脚本的最后一个参数

python - 在 Python 中导入 LinkedIn API 时出错

python - 无法确定父/子表之间的连接条件,设置外键

python - 如何缩短这个 bool 表达式?

php - 在函数参数中使用单管道 '|' 有什么作用?