forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrings_3.12_new.py
More file actions
21 lines (16 loc) · 818 Bytes
/
strings_3.12_new.py
File metadata and controls
21 lines (16 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# An expression containing the same kind of quotes as the outer f-string
songs = ['Take me back to Eden', 'Alkaline', 'Ascensionism']
f"This is the playlist: {", ".join(songs)}"
# An example of the previously maximal level of nesting
f"""{f'''{f'{f"{1+1}"}'}'''}"""
# An example of the new, unlimited level of nesting
f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}"
# An f-string with newlines inside the expression part
f"This is the playlist: {", ".join([
'Take me back to Eden', # My, my, those eyes like fire
'Alkaline', # Not acid nor alkaline
'Ascensionism' # Take to the broken skies at last
])}"
# Two instances of string escaping used inside the expression part
print(f"This is the playlist: {"\n".join(songs)}")
print(f"This is the playlist: {"\N{BLACK HEART SUIT}".join(songs)}")