Answers for "get pythonpath and python home"

1

get python script path

import os
def GetScriptPath():
    return os.path.realpath(__file__);

print(GetScriptPath());
Posted by: Guest on June-11-2021
0

show pythonpath

# option a
import os
print(os.environ['PYTHONPATH'].split(os.pathsep))

# option b
import sys
print(sys.path)
Posted by: Guest on September-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language