The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
newbie
Discuss newbie in the Python Programming forum on Dev Shed. newbie Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 26th, 2004, 08:41 AM
|
 |
Contributing User
|
|
Join Date: May 2003
Location: GB
Posts: 553
Time spent in forums: 27 sec
Reputation Power: 10
|
|
|
newbie
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
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
Wack open notepad or any other text editor and type..
Code:
#!/usr/bin/env python
print 'hello world'
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.
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:
http://www.python.org/doc/Intros.html
http://www.hetland.org/python/instant-hacking.php
Welcome to the Python community,
Mark.
__________________
programming language development: www.netytan.com – Hula
|

June 26th, 2004, 01:45 PM
|
|
Contributing User
|
|
Join Date: Jun 2004
Posts: 37
Time spent in forums: 1 h 28 m 24 sec
Reputation Power: 9
|
|
|
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.
cd C:\Python\folder
helloworld.py
|

June 27th, 2004, 04:24 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
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!
Mark.
|

June 27th, 2004, 06:55 AM
|
 |
Contributing User
|
|
Join Date: May 2003
Location: GB
Posts: 553
Time spent in forums: 27 sec
Reputation Power: 10
|
|
|
cheers guy iwas wondering why it flashed on the screen
|

June 27th, 2004, 10:54 AM
|
|
Contributing User
|
|
Join Date: Jun 2004
Posts: 37
Time spent in forums: 1 h 28 m 24 sec
Reputation Power: 9
|
|
|
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.
Thanks again!
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
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
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.
Have fun,
Mark.
|

June 27th, 2004, 12:07 PM
|
|
Contributing User
|
|
Join Date: Jun 2004
Posts: 37
Time spent in forums: 1 h 28 m 24 sec
Reputation Power: 9
|
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|