Passing python array to bash script (and passing bash variable to python function)

后端 未结 5 779
感情败类
感情败类 2021-01-02 16:27

I have written a Python module which contains functions that return arrays. I want to be able to access the string arrays returned from the python module, and iterate over i

5条回答
  •  佛祖请我去吃肉
    2021-01-02 16:57

    In addition, you can tell python process to read STDIN with "-" as in

    echo "print 'test'" | python -
    

    Now you can define multiline snippets of python code and pass them into subshell

    FOO=$( python - <

    You can also use env and set to list/pass environment and local variables from bash to python (into ".." strings).

提交回复
热议问题