-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtest.py
More file actions
84 lines (61 loc) · 1.14 KB
/
test.py
File metadata and controls
84 lines (61 loc) · 1.14 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
f'hello {world!s}'
f'1{one:#06x}2{two:format}3{three!s:++++}'
f'goodbye {cruel} world'
f'ascii{thing!a}'
f'{x!r}'
f'''My name is {name}, my age next year is
{age+1}, my anniversary is
{anniversary:%A, %B %d, %Y}.'''
#Implicit concatenation
"hello" f' {world!s}'
# Simplified version of FP reported in issue #1990
f"{1,1}{1,1}"
# Trailing comma for 1-element tuple:
f"{1,}{1,}"
# Parenthesized with newline after string.
# Simplified version of FP reported in issue #2453
(f"""0"""
)
(f"0"
)
(f'''0'''
)
(f'0'
)
(f"""{0}"""
)
(f"{0}"
)
(f'''{0}'''
)
(f'{0}'
)
("""0"""
)
("0"
)
('''0'''
)
('0'
)
# Unicode literals inside fstrings in initial position
f'\N{DEGREE SIGN}{degrees}'
# Unicode literals inside fstrings in non-initial position
f'{1}\N{DEGREE SIGN}'
# {{ in initial position
f'{{ a{1}c'
# {{ in non-initial position
f'a{1}{{c'
# Unicode literals inside fspecs in initial position
f'pre{1:\N{LATIN SMALL LETTER B}>0.0f}post'
# Unicode literals inside fspecs in initial position
f'pre{1:0\N{LATIN SMALL LETTER B}}post'
# }} in initial position
f'}} a{1}c'
# }} in non-initial position
f'a{1}}}c'
# Empty f-strings
f''
f""
f''''''
f""""""