|
|
@ -273,15 +273,15 @@ import re |
|
|
|
Format |
|
|
|
------ |
|
|
|
```python |
|
|
|
<str> = '{}, {}'.format(<el_1>, <el_2>) |
|
|
|
<str> = f'{<el_1>}, {<el_2>}' |
|
|
|
<str> = '{}, {}'.format(<el_1>, <el_2>) |
|
|
|
``` |
|
|
|
|
|
|
|
```python |
|
|
|
>>> person = {'name': 'Jean-Luc', 'height': 187.1} |
|
|
|
>>> '{p[height]:.0f}'.format(p=person) |
|
|
|
>>> person = {'name': 'Jean-Luc', 'height': 187} |
|
|
|
>>> f"{person['height']}" |
|
|
|
'187' |
|
|
|
>>> f"{person['height']:.0f}" |
|
|
|
>>> '{p[height]}'.format(p=person) |
|
|
|
'187' |
|
|
|
``` |
|
|
|
|
|
|
|