Python Forum
Trying to write and execute first Python script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to write and execute first Python script
#2
(May-21-2020, 02:04 PM)garvind25 Wrote: I then tried to run the script by right clicking on it and selecting ‘Open with --> Python’. A small command line window did come up but disappeared within a second.
Add this,use code as shown here when post code,look at BBCode.
This will prevent cmd to close,has to hit Enter.
print('one')
print('two')
print('three')
input('Press Enter to exit')
You should general to it from command line(cmd) or Anaconda Prompt.
Learning to use command line is important in programming.
This is like this,now could also drop last line.
(base) C:\Miniconda3>python first_script.py
one
two
three
Press Enter to exit

(base) C:\Miniconda3>
See that (base) is active,this most always be activated when use Anaconda3 or Miniconda.
Other to look into with Anaconda3 is conda and also pip.
So it's use to install stuff if needed,try conda if not Repo then pip.

Also if start Anaconda Navigator there are link to editor like Spyder or can start Jupyter Notebook.
Reply


Messages In This Thread
RE: Trying to write and execute first Python script - by snippsat - May-21-2020, 03:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,398 Jun-29-2023, 11:57 AM
Last Post: gologica
  Is this possible to write a script for checking data from website? WanW 2 1,148 Jun-02-2022, 02:31 AM
Last Post: Larz60+
  How To Set Up And Execute A Python File knight2000 4 1,976 May-31-2022, 10:02 AM
Last Post: Larz60+
  Is it possible to write a python script to block twitter feeds? cubangt 0 888 Apr-07-2022, 04:14 PM
Last Post: cubangt
  execute python script guy7200 1 1,620 Oct-25-2021, 09:55 PM
Last Post: Axel_Erfurt
  Possible to execute a python script before log off/shutdown with input commands? Kaltex 1 2,294 May-18-2021, 06:31 AM
Last Post: Skaperen
  Using python to execute app or cmd that requires admin credentials thewolf 0 2,136 Mar-05-2021, 08:15 PM
Last Post: thewolf
  Execute DBCC CHECKDB from python script susja 1 2,149 Aug-12-2020, 02:09 AM
Last Post: susja
  Execute full script samuelbachorik 0 1,552 Aug-06-2020, 08:09 PM
Last Post: samuelbachorik
  How to kill a bash script running as root from a python script? jc_lafleur 4 5,980 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020