1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-11-24 05:37:39 +00:00

Merge pull request #234 from rhyw/python-fix-typo

Fix several typos in python.md
This commit is contained in:
Julien Le Coupanec 2021-10-08 12:59:43 +02:00 committed by GitHub
commit 92c6c88716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,15 +70,15 @@
| yield | yields values instead of returning (are called generators) | returning keyword | | yield | yields values instead of returning (are called generators) | returning keyword |
| import | import libraries/modules/packages | import | | import | import libraries/modules/packages | import |
| from | import specific function/classes from modules/packages | import | | from | import specific function/classes from modules/packages | import |
| try | this block will be tried to get executed | execption handling | | try | this block will be tried to get executed | exception handling |
| execpt | is any execption/error has occured it'll be executed | execption handling | | except | is any exception/error has occured it'll be executed | exception handling |
| finally | It'll be executed no matter execption occurs or not | execption handling | | finally | It'll be executed no matter exception occurs or not | exception handling |
| raise | throws any specific error/execption | execption handling | | raise | throws any specific error/exception | exception handling |
| assert | throws an AssertionError if condition is false | execption handling | | assert | throws an AssertionError if condition is false | exception handling |
| async | used to define asynchronous functions/co-routines | asynchronous programming | | async | used to define asynchronous functions/co-routines | asynchronous programming |
| await | used to specify a point when control is taken back | asynchronous programming | | await | used to specify a point when control is taken back | asynchronous programming |
| del | deletes/unsets any user defined data | variable handling | | del | deletes/unsets any user defined data | variable handling |
| global | used to access variables defined outsied of function | variable handling | | global | used to access variables defined outside of function | variable handling |
| nonlocal | modify variables from different scopes | variable handling | | nonlocal | modify variables from different scopes | variable handling |
<br> <br>
@ -159,8 +159,8 @@ thislist = list(("apple", "banana", "cherry")) # note the double round-brackets
```python ```python
thislist = ["apple", "banana", "cherry"] thislist = ["apple", "banana", "cherry"]
print(thislist.pop())# cherry print(thislist.pop()) # cherry
print(thislist.pop(0)) #apple print(thislist.pop(0)) #apple
``` ```
@ -194,7 +194,7 @@ print(len(thistuple))
thistuple = ("apple",) thistuple = ("apple",)
print(type(thistuple)) print(type(thistuple))
#NOT a tuple # NOT a tuple
thistuple = ("apple") thistuple = ("apple")
print(type(thistuple)) print(type(thistuple))
``` ```