Browse Source

Main, format

pull/23/head
Jure Šorn 5 years ago
parent
commit
21dcea9bd2
1 changed files with 4 additions and 2 deletions
  1. 6
      README.md

6
README.md

@ -9,7 +9,7 @@ Comprehensive Python Cheatsheet
Main
----
```python
if __name__ == '__main__':
if __name__ == '__main__': # Runs main() if file wasn't imported.
main()
```
@ -314,7 +314,8 @@ Format
```
```python
>>> Person = collections.namedtuple('Person', 'name height')
>>> from collections import namedtuple
>>> Person = namedtuple('Person', 'name height')
>>> person = Person('Jean-Luc', 187)
>>> f'{person.height}'
'187'
@ -357,6 +358,7 @@ Format
{-123456: } # '-123456'
```
#### Char, Hex, Binary:
```python
{90:c} # 'Z'
{90:X} # '5A'

Loading…
Cancel
Save