What is the best way to execute a single-line of Python 3 and return the result to a Python 2 program. For example:
#!/usr/bin/env python2
# Not valid code
pwsd = exec("python3 -c 'import crypt; print(crypt.crypt(\"<password_str>\",salt=crypt.METHOD_SHA512))'")
execis for executing a string of python code docs.python.org/3/library/functions.html#exec but here you are passing it something like a shell script to run the python3 intepreter. Try running that with docs.python.org/3/library/subprocess.html instead