特に分類できないメモ。
Python 3.8~
代入と比較を一度に行う。
a = 1
b = 9
if ((r := a - b) >= 0):
print(diff)
>>> import string
>>> string.whitespace
' \\t\\n\\r\\x0b\\x0c'
>>> string.punctuation
'!"#$%&\\'()*+,-./:;<=>?@[\\\\]^_`{|}~'
Python 3.6~
>>> thing = "apple"
>>> f"This is an {thing}"
'This is an apple'
>>> f"This is an {thing.capitalize()}"
'This is an Apple'
>>> f"This is an {thing:.^10}"
'This is an ..apple...'
Python 3.8~
変数の値に加えて、その変数名も表示できる。