Python is a general purpose, high level, Interpreted Programming Language. The Python philosophy emphasises readability and simplicity. To this day, Python enforces the use of indentation to denote code blocks, and features dynamic typing along with automatic memory management.

Python's use of indentation as a code block delimiter makes it unique among popular programming languages, and enforces a single consistent coding style, unlike C and Java. This is one of the more popular features of the language within the Python community, though it is sometimes confusing for those new to the language who are conversant with other programming languages.

Python is frequently used as a scripting language, but its large array of built-in libraries means that it is also used more frequently than other high-level languages for general-purpose programming.

Code Examples
MD5 Checksum

SHA checksum

Standard input

Standard output

Standard error

Read file

Write file


Basic BookmarksEdit

Other interesting stuffEdit

  • Python syntax (Wikipedia) Python Syntax, including functional-programming in Python

Including Sample Code in a WikiEdit

To put code in one of these boxes, you have to indent each line of wiki-text by one space:

 def function():
     print "hello"

Fortunately, cutting and pasting out of the box results in properly formatted Python code. To quickly format your code for cut-and-paste into the wiki on a Linux computer, you can use the sed command.

 $ sed -e 's/^/ /' <

This command adds a single space to the beginning of each line of your file. Since empty lines cause new boxes to be created, you'll probably want to adjust the output code to taste.

Easier Editing ExternallyEdit

For even easier editing, you can use an external (read: sane) text editor. There are apparently [lots of ways]. I did the [] method, and it worked.

In vim, you can add a line to your vimrc that will add one space to any block of text that you highlight, if you press backslash-p.

:map <leader>p :!sed -e 's/^/ /'<CR>

Tab completion Edit

Tab completion can be implemented in the python interpreter with the following in your ~/.pythonrc:

import readline, rlcompleter
readline.parse_and_bind("tab: complete")

Then save the following line in your .bashrc and run it in any open terminals it needs to take effect on:


External Links Edit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.