forked from zhanghe06/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_indent.py
More file actions
46 lines (34 loc) · 1.02 KB
/
test_indent.py
File metadata and controls
46 lines (34 loc) · 1.02 KB
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
39
40
41
42
43
44
45
46
# encoding: utf-8
__author__ = 'zhanghe'
bb = {'001': 'a', '000000002': 'bbbbbb', '0003': 'c', '0000004': 'ddd'}
for a, b in bb.items():
print('%-20s: %s' % (a, b))
def print_fill_with():
input_str_list = [
"abc",
"abcd",
"abcde",
]
for eachStr in input_str_list:
# print '{:->10}'.format(eachStr)
print '{0:->10}'.format(eachStr)
# -------abc
# ------abcd
# -----abcde
for eachStr in input_str_list:
print '{0:-<20}'.format(eachStr)
# abc-----------------
# abcd----------------
# abcde---------------
for eachStr in input_str_list:
print '{0:*^30}'.format(eachStr)
# *************abc**************
# *************abcd*************
# ************abcde*************
if __name__ == "__main__":
print_fill_with()
a = '好长的汉字啊一定是...'
b = '影视/媒体/艺术/文化'
print len(a)
print len(a.decode('utf-8'))
print len(b.decode('utf-8'))