-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstring_format.py
More file actions
25 lines (25 loc) · 765 Bytes
/
string_format.py
File metadata and controls
25 lines (25 loc) · 765 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
#! /usr/bin/env python3
# -*- coding:utf-8 -*-
###############################################################
# © kenwaldek MIT-license
#
# Title: .format Version:
# Date: 24-12-16 Language: python3
# Description: testing .format string format
#
###############################################################
print ('{:10}'.format('test'))
###
name = "kenny"
print ("my name is {:1} and it works".format(name))
###
print ('{:d}'.format(42)) # nummers = :d van decimaal
###
print ("{:f}".format(3.141592653589793)) # float na de comma dus PI
###
a = "dit"
b = "zijn"
c = "variablen"
print('{0}, {1}, {2}'.format('a', 'b', 'c')) # dit zijn strings
print('{0}, {1}, {2}'.format(a, b, c)) # dit zijn de variablen
###