怎样在Shell中运行Python的多行代码

https://stackoverflow.com/questions/40143190/how-to-execute-multiline-python-code-from-a-bash-script

#!/bin/bash

# some bash code
END_VALUE=10

PYTHON_CODE=$(cat <<END
# python code starts here
import math

for i in range($END_VALUE):
    print(i, math.sqrt(i))

# python code ends here
END
)

# use the 
res="$(python3 -c "$PYTHON_CODE")"

# continue with bash code
echo "$res"