I have a bash script and a python script:
script
#!/bin/bash
a=10
export a
python script.py
script.py
# access 'a' somehow
Is there a way to access the export
ed variables from python?
I have a bash script and a python script:
script
#!/bin/bash
a=10
export a
python script.py
script.py
# access 'a' somehow
Is there a way to access the export
ed variables from python?
Exported variables are set as environment variables. Use os.environ
(a dictionary) to read these in your Python script:
import os
a = os.environ['a']