简体   繁体   中英

Get Python Shell open

So i open Python 3.7.3 and all i get is a black window that looks like the command prompt window. Where is the shell? Where do I write my code? I saw an example with this same version of python where there were 2 white windows, one with the code and the other being the shell but i am confused how to set that up.

Is there a difference between just python 3.7.3 and IDLE? As you can see I am basically lost in this whole situation.

The window that I see looks like this: https://imgur.com/a/rMOMEh5

You have a few options, to name the basic ones:

  1. Write your python code as a plain text file with an editor of your choice, and execute using:

python myfile.py

  1. Write your python code in a simple IDE (eg sublime, atom) that has fancy features such as auto-indentation and colour coding, and execute using:

python myfile.py

  1. Write your code in a fancy IDE that allows you to have shell and code at the same time, and execute within the IDE (eg PyCharm)

That's the python shell where you can issue python commands. You can call a python script as stated above and even code python directly in that window. Here is an example:

  1. Type from secrets import token_urlsafe and hit return. Now you've imported your first python module.
  2. Type ran_num = token_urlsafe(16) and hit return. Now we've declared a variable called ran_num and gave it the value of 16 random number, letters, and characters.
  3. Type print(ran_num) and look at the output, which should be something like this - W2Z6O4XGebDa-eXbJY5p3Q

This is just one example. There are a lot of uses.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM