This is an old revision of the document!


Collection of Snippets for Python

The Python snippets are inspired by Gedit.

Just copy the the [Special] and [Python] sections from the code below into your snippets file, e.g. in ~/.config/geany/snippets.conf.

[Special]
wordchars=._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

[Python]
for=for i in xrange(%cursor%):\n\t
doc=""" %cursor% """\n
elif=elif %cursor%:\n\t
else=else:\n\t%cursor%
if=if %cursor%:\n\t
from=from %cursor% import \n
main=if __name__ == '__main__':\n\t%cursor%
class=class %cursor%(object):\n\t""" Class doc """\n\t\n\tdef __init__ (self):\n\t\t""" Class initialiser """\n\t\tpass
def=def %cursor%(self):\n\t""" Function doc\n\n\t@param PARAM: DESCRIPTION\n\t@return RETURN: DESCRIPTION\n\t"""\n\t
get=def get%cursor%(self): return self._var\n
set=def set%cursor%(self): self._var = var\n
.=self.%cursor%
try=try:\n\t%cursor%\nexcept Exception, e:\n\t
py=#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\n%cursor%
while=while %cursor%:\n\t
with=with %cursor%:\n\t
head="""\n\t%cursor%PROJECT - MODULE\n\n\tDESCRIPTION\n\n\t@copyright: {year} by {developer} <{mail}>\n\t@license: GNU GPL, see COPYING for details.\n"""\n
pp=from pprint import pprint\npprint(%cursor%)
cod=# coding: utf-8
dt=from datetime import datetime
Print/export