Because it was troublesome to write an import statement every time I started it with the python interpreter I investigated the setting method that automatically imports at the time of startup.
Create the following files in the home directory (C: \ Users \ <username> \
)
python:.pythonstartup.py
from datetime import datetime
date = datetime.now()
Or something like that Set the following in the environment variables
setx PYTHONSTARTUP C:\Users\<username>\.pythonstartup.py
After that, just type python
at the command prompt and the contents of the file will be executed.
>python
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
2020-12-23 20:35:52.167887
>>>
It is convenient to write the module import statement that you often use in the pythonstartup.py
file.
After that, if you set the path of the module under test with the environment variable, it is convenient when you only test
Recommended Posts