Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung | ||
meins:python:strings-und-print [Sunday, 05. Jun 2016 12:16] – [Formatter] Ivo Schwalbe | meins:python:strings-und-print [Sunday, 05. Jun 2016 12:25] (aktuell) – [Formatter] Ivo Schwalbe | ||
---|---|---|---|
Zeile 46: | Zeile 46: | ||
</ | </ | ||
- | http:// | + | http:// |
+ | https:// | ||
<code python> | <code python> | ||
Zeile 76: | Zeile 77: | ||
# print " | # print " | ||
print w + e | print w + e | ||
+ | </ | ||
+ | |||
+ | <code python> | ||
+ | # 10 Punkte | ||
+ | print " | ||
+ | </ | ||
+ | |||
+ | <code python> | ||
+ | # Format als string speichern | ||
+ | formatter = "%r %r %r %r" | ||
+ | |||
+ | # Format mit verschiedenem Inhalt mischen | ||
+ | # Achtung: Geht nur mit %r, weil string, int (und float) | ||
+ | print formatter % (1, 2, 3, 4) | ||
+ | print formatter % (" | ||
+ | print formatter % (True, False, False, True) | ||
+ | print formatter % (formatter, formatter, formatter, formatter) | ||
+ | print formatter % ( | ||
+ | "I had this thing.", | ||
+ | "That you could type up right.", | ||
+ | "But it didn't sing.", | ||
+ | "So I said goodnight." | ||
+ | ) | ||
</ | </ |