Tyto stránky již nejsou udržovány. Obsah je postupně přesouván/aktualizován na adrese chytrosti.marrek.cz.
1575/14246
1 #!/usr/bin/python
2 # -*- coding: utf8 -*-
3 # Soubor: 20111115-Tue-tabulka.py
4 # Datum: 15.11.2011 08:15
5 # Autor: Marek Nožka, nozka <@t> spseol <d.t> cz
6 # Licence: GNU/GPL
7 # Úloha: tisk tabulky
8 # Popis: vzorová úloha na ukázku formátování
9
10
11 print """/{0:s}\\
12 | Tabulka
13 \\{1:s}/
14 | {2:4s} | {3:8s} | {4:>6s} | {5:4s} |{6:s}|
15 {7}""".format(37*'-', 37*'-','dec','bin','oct','hex', 'chr',39*'-')
16
17
18 i = 32
19 while i<127:
20 print "| {0:4d} | {1:08b} | {2:>06o} | {3:4X} | {4:s} |"\
21 .format(i,i,i,i, chr(i) )
22 i += 1
23 print "\\{0:s}/".format(37*'-')
24
25
26 i=1.23456789
27 print "{0:10.3f} {1:10.3e} {2:10.3g}".format(i,i*i,0.000000314)
28