Completely noob Python query.

Psychosocial

Violent serenity.
So I thought of learning programming and thought that Python is the easiest and the simplest to begin with. I got around writing the Hello World script but the problem is when I save and run the file, nothing happens. The Python command shell should open showing 'Hello World' but nothing happens. The command line opens and closes in a flash. This was what happened to me when I tried to learn Python before a few months too! What's the damn problem ? I am on Win7 32Bit and using Python 3.1. Using Notepad++ to code but that's not the prob coz I even tried to do it with the Python GUI but it gave the same result.

Any helps ?
 

abhijangda

Padawan
hey there are many ways of doing so,
1st is open Python's IDLE, then go to File--> Open (or something like that). Open ur Python script, then go to Run --> Run Module. This will run ur program.

2nd is copy your script to Pythons folder. Then run Python and enter "from script.py import *'' or ''import script.py'', where script.py is your script's name

3rd is u can go to command prompt. by typing 'cmd' in Run, then type '' python scriptpath.py'' here scriptpath.py is your scripts path and filename.

also in step 2nd and 3rd remember to add .py as extension.

actually flash just displays the output and closes in no time. i will recommend u to use IDLE to code python's programs, using any other editor may create some indentation problems.
 
OP
Psychosocial

Psychosocial

Violent serenity.
Woah thanks man! Will try them!

---------- Post added at 09:23 AM ---------- Previous post was at 09:22 AM ----------

EDIT ...lol the first solution itself worked! Thanks a lot!
 
Top Bottom