Python

Wechseln zu: Navigation, Suche

Snippets

Shebang

#!/usr/bin/env python
# -*- coding: utf-8 -*-

if-else-Einzeiler

VAR = VALUE1 if CONDITION else VALUE2

(Dokumentation)

foreach-Einzeiler

# double first prime numbers
primes = [ 2, 3, 5, 7, 11, 13, 17, 19 ]
print map(lambda prime: prime * 2, primes)