Skip to content

Commit

Permalink
new stuff added
Browse files Browse the repository at this point in the history
  • Loading branch information
mraza007 committed Jan 12, 2019
1 parent 0395612 commit 2a8f412
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion markdown-version/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,23 @@ def hey(name):
import file1 as fn
fn.hello()
fn.hey('Jake')
```
```

## External Modules
External modules can be found here [PyPi](https://pypi.org/)
- We can install modules using `pip`, `pip install <package-name>`.
- Pip comes default in `Python 3.4` we can run using `python3 -m pip install <package-name>`.
- `print(dir(<package_name>))` This tells us about the attributes.
- `print(help(package_name))` This tells us everything about the package

## Using PEP8 to cleanup Code

- We can use `autopep8` to fix whitespaces and ident our code
- We can use `autopep8 --in-place <file_name>`


## The `__name__` variable
- The `__name__` variable usually refers to the file name if its the file then it will interpreted as `__main__`
- If it's a module then `__name__` will be interpreted as the `__file_name__`.

**Note** : use `if __name__ = '__main__' `

0 comments on commit 2a8f412

Please sign in to comment.