python gets the script execution directory and adds it to the environment variable,
Because there is a driver chromedriver.exe
in the current directory,
You need to use after the
python
dir_path = sys.path[0]
The current script execution directory already exists. How to add it to the environment variable later?
Is it executed using cmd
of python
?
python
It’s my first time using it. I hope python
can give me some guidance
typecho2017-06-22 11:54:22
There are two methods,
The first is to use the sys.path.append()
method to add the current directory to the directory list searched by the module, such as sys.path.append(dir_path)
The second is to The path of the current directory is added to the system’s PYTHONPATH environment variable.