forked from exo7math/python1-exo7
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguide_format.py
More file actions
38 lines (23 loc) · 714 Bytes
/
guide_format.py
File metadata and controls
38 lines (23 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
##############################
# Guide - Mise en formae
##############################
# Alignement à gauche
print('{:10}'.format('Test'))
# Alignement à droite
print('{:>10}'.format('Test'))
# Centré
print('{:^10}'.format('Test'))
# Entier
print('{:d}'.format(456))
# Entier sur longueur fixée
print('{:6d}'.format(456))
# Entier avec 0 non significatifs
print('{:06d}'.format(456))
# Nombre flottant
print('{:f}'.format(3.141592653589793))
# Flottant avec nb de chiffesd après la virgules
print('{:.8f}'.format(3.141592653589793))
# Nombre flottant sur longueur fixée
print('{:8.4f}'.format(3.141592653589793))
# Flottant avec 0 non significatifs
print('{:08.4f}'.format(3.141592653589793))