Skip to content

Commit 21dcea9

Browse files
committed
Main, format
1 parent f10f28a commit 21dcea9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Comprehensive Python Cheatsheet
99
Main
1010
----
1111
```python
12-
if __name__ == '__main__':
12+
if __name__ == '__main__': # Runs main() if file wasn't imported.
1313
main()
1414
```
1515

@@ -314,7 +314,8 @@ Format
314314
```
315315

316316
```python
317-
>>> Person = collections.namedtuple('Person', 'name height')
317+
>>> from collections import namedtuple
318+
>>> Person = namedtuple('Person', 'name height')
318319
>>> person = Person('Jean-Luc', 187)
319320
>>> f'{person.height}'
320321
'187'
@@ -357,6 +358,7 @@ Format
357358
{-123456: } # '-123456'
358359
```
359360

361+
#### Char, Hex, Binary:
360362
```python
361363
{90:c} # 'Z'
362364
{90:X} # '5A'

0 commit comments

Comments
 (0)