June 26th, 2004, 08:41 AM
i downloaded python, and no how to use it interactively, but how do i write a basic hello world script in windows, and get this to execute - it doesnt say in the official tutorial -cheers
June 26th, 2004, 09:08 AM
Wack open notepad or any other text editor and type..
The first line is technically not needed on Windows but it is a good practice to adopt if you ever plan to do any CGI or run a script on *nix.
print 'hello world'
And to run this program simply save it as a text document with a .py extension and double click on this file .
Also check out these links:
Welcome to the Python community,
June 26th, 2004, 01:45 PM
If you run it in a windows enviroment you are going to see it flash on the screen...
So what I do is have C:\Python\folder hold all my Python stuff...
and then type the following.
June 27th, 2004, 04:24 AM
Another way to get around this anoying problem is to add 'raw_input()' to the end of your files . Its a bit of a hack but very handy!
June 27th, 2004, 06:55 AM
cheers guy iwas wondering why it flashed on the screen
June 27th, 2004, 10:54 AM
Yeah, thanks for the little hack. I knew something like that would work, but always program in a text editor and test in the command prompt so I've never had a need for that.
Anyone know of a way to change that in windows ? Becuase it does that with ipconfig and such as well. It's rather a pain.
June 27th, 2004, 11:24 AM
Not of the top of my head though i imagine this could be done by altering site.py, which is loaded when Python starts. Something you would have to mess around with since i dont have Python right now .
One thing you should remember when altering a Python installations properties is that if anyone else runs your program they will not get the same results i.e. in this case where the console Window would stay on screen for you, other users would see if flash up and disapper.
June 27th, 2004, 12:07 PM
oh, I meant inside of windows. So if I ran a bash program or ipconfig or anything like that it just wouldn't flash up there.
Oh, another thing the dave2k could do is create a bash program that when he double clicked it, it would load the folder he saved all this python stuff too.