Summary of Python—10

Because I taught myself Python while I was at work, once I got busy, Python would put it away for two days, but I forgot what I learned two days later.

Today, summarize the various startup methods of Python.

My document path: ——- 

 

1Open the CMD where the file is located and tap directly in the command line.python Filename.Py (with.Py file suffix),It can output results directly.

  

 

Note: this opens the path directly. The filename.Py is not found.

 

2Open the CMD where the file is, and on the command line, tap directly: python, first enter the python interaction mode, and see & gt; & gt; & gt; symbols,

Then percussion:import Filename (no py file suffix)、 import Path. Path. File name (without py file suffix)

 

 

3Open the CMD where the file is, and on the command line, tap directly: python, first enter the python interaction mode, and see & gt; & gt; & gt; symbols,

Then click: from the lower path of the current path import file name under the lower path (no py file suffix)

 

Note: The file name (without the PY file suffix) under the current path import from the current path will not be found, as shown in the screenshot above.

 

 The above usage has nothing to do with __init__.py in directory.

 

Leave a Reply

Your email address will not be published. Required fields are marked *