Create README.md
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
parent
8e934bfd0b
commit
36d0f1fa4b
1 changed files with 71 additions and 0 deletions
71
python_basics/keywords/README.md
Normal file
71
python_basics/keywords/README.md
Normal file
|
@ -0,0 +1,71 @@
|
|||
# Python keywords
|
||||
{:.no_toc}
|
||||
|
||||
<nav markdown="1" class="toc-class">
|
||||
* TOC
|
||||
{:toc}
|
||||
</nav>
|
||||
|
||||
## The goal
|
||||
|
||||
You need to know the keywords for Python because you should not use them as variable, class, or function names.
|
||||
|
||||
Questions to [David Rotermund](mailto:davrot@uni-bremen.de)
|
||||
|
||||
## [Keywords](https://docs.python.org/3/library/keyword.html)
|
||||
|
||||
```python
|
||||
import keyword
|
||||
|
||||
print(keyword.kwlist)
|
||||
print()
|
||||
print(keyword.softkwlist) # -> ['_', 'case', 'match']
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```python
|
||||
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
|
||||
```
|
||||
|
||||
||
|
||||
|---|
|
||||
|False|
|
||||
|None|
|
||||
|True|
|
||||
|and|
|
||||
|as|
|
||||
|assert|
|
||||
|async|
|
||||
|await|
|
||||
|break|
|
||||
|class|
|
||||
|continue|
|
||||
|def|
|
||||
|del|
|
||||
|elif|
|
||||
|else|
|
||||
|except|
|
||||
|finally|
|
||||
|for|
|
||||
|from|
|
||||
|global|
|
||||
|if|
|
||||
|import|
|
||||
|in|
|
||||
|is|
|
||||
|lambda|
|
||||
|nonlocal|
|
||||
|not|
|
||||
|or|
|
||||
|pass|
|
||||
|raise|
|
||||
|return|
|
||||
|try|
|
||||
|while|
|
||||
|with|
|
||||
|yield|
|
||||
|_|
|
||||
|case|
|
||||
|match|
|
||||
|
Loading…
Reference in a new issue