Skip to content

Commit 2a8f412

Browse files
committed
new stuff added
1 parent 0395612 commit 2a8f412

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

markdown-version/modules.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,23 @@ def hey(name):
3131
import file1 as fn
3232
fn.hello()
3333
fn.hey('Jake')
34-
```
34+
```
35+
36+
## External Modules
37+
External modules can be found here [PyPi](https://pypi.org/)
38+
- We can install modules using `pip`, `pip install <package-name>`.
39+
- Pip comes default in `Python 3.4` we can run using `python3 -m pip install <package-name>`.
40+
- `print(dir(<package_name>))` This tells us about the attributes.
41+
- `print(help(package_name))` This tells us everything about the package
42+
43+
## Using PEP8 to cleanup Code
44+
45+
- We can use `autopep8` to fix whitespaces and ident our code
46+
- We can use `autopep8 --in-place <file_name>`
47+
48+
49+
## The `__name__` variable
50+
- The `__name__` variable usually refers to the file name if its the file then it will interpreted as `__main__`
51+
- If it's a module then `__name__` will be interpreted as the `__file_name__`.
52+
53+
**Note** : use `if __name__ = '__main__' `

0 commit comments

Comments
 (0)