| You are here: | About>Computing & Technology>Python> Beginning Python> Python "Hello World" Tutorial - "Hello, World!": A Quick Tutorial on Python |
![]() | Python |
"Hello, World!": A Quick Tutorial on PythonIntroducing "Hello, World!"The simplest program in Python consists of a line that tells the computer a command. Traditionally, the first program of every programmer in every new language prints "Hello, World!". Start up your favorite editor and save the following into a file: print "Hello, World!" To execute this program, save it with a suffix of '.py' (e.g., HelloWorld.py) and type 'python' and the filename in a shell like this: > python HelloWorld.pyThe output is predictable: Hello, World! If you prefer to execute it by its name, instead of as an argument to the Python interpreter, put a "bang" line at the top. Include the following on the first line of the program, substituting the absolute path to the Python interpreter for /'path/to/python': #!/path/to/pythonBe sure to give change the permission on the file to allows execution, if necessary for your operating system. Now, let's take this program and embellish it a bit.
Previous | Next >> |
Las Vegas on a BudgetFind a BargainHotel DealsCheap EatsFree AttractionsEntertainment for Less |
All Topics | Email Article | | | ![]() |
| Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help | Our Story | Be a Guide |
| User Agreement | Ethics Policy | Patent Info. | Privacy Policy | ©2008 About, Inc., A part of The New York Times Company. All rights reserved. |


