In Python, single lines can be commented by the hash symbol (#
):
# this is a comment.
print(a + b) # adding the variables
Also, multi-line comments can be enclosed by triple quotes:
'''
This is a longer description
that stretches over multiple lines.
'''
The triple quoted comments can be used to generate documentation automatically.
Which lines are commented?
-
"""This is a comment"""
-
# This is a comment
-
// This is a comment
-
<!-- This is a comment !-->
-
'''This is a comment'''
Is returned as an integer by the len()
function.
s = 'Manipulating Strings '
print(len(s)
len() dict if Kommentare escape characters Formatstrings math open() TRANSFER: Matrix mutable/immutable, simple/composed sum() sorted() import pip Bücher und Webseiten Eingabe-Verarbeitung-Ausgabe Copy-Paste-Programmierung Vom Skript zur Software Fehlerbehebung
- Datei mit Babynamen laden
- ersten Buchstaben ausgeben
- Gesamte Geburten für 1 Buchstaben
- Gesamte Geburten für alle Buchstaben einzelnt
- Ausgabe als Tabelle auf dem Bildschirm
- Alle Jahrgänge laden
- Tabelle Excel exportieren
- Timeline plotten
Creating plots The Matplotlib library contains a wide range of possibilities for creating graphs. See the 'gallery' link on http://matplotlib.sourceforge.net for examples. It needs to be installed separately. from pylab import * Number crunching Numpy is a library that allows operating on arrays and matrices. It needs to be installed separately. See: http://numpy.scipy.org import numpya = numpy.array( [1,2,3,4,5,6] )print a+10, a*a Image manipulation The Python Imaging Library PIL is a powerful tool for working with images (changing formats, resizing, cutting, drawing). It needs to be installed separately. See http://www.pythonware.com/products/pil .