我试图在Bash脚本中运行一些Python代码,所以我想了解之间的区别是什么:
#!/bin/bash
#your bash code
python -c "
#your py code
"
Run Code Online (Sandbox Code Playgroud)
VS
python - <<DOC
#your py code
DOC
Run Code Online (Sandbox Code Playgroud)
我检查了网络,但无法编译主题周围的位.你认为一个比另一个好吗?如果你想从Python代码块返回一个值到你的Bash脚本,那么heredoc是唯一的方法吗?