Learn Python - The Hard Way
Set of simple programs written during learning basics of Python language based on Learn Python - The Hard Way course. All tasks can be found in exercises directory. In the same directory, we can found another
README.md file including list of all tasks. Moreover, this
README.md file includes important and essential information concerning programming in Python. You can also read a short article about this project on my blog.
- Installing Python
- Executing Python scripts from terminal
- Installing Pip on Windows
- Installing Pip on Linux
- Installing Pip on macOS
- Using Pip
- Unit Testing
- Scripts on Linux
- Style Guide for Python Code
- Static code analysis
- Development Environments
- Python web frameworks
- Useful Python libraries
- Tools written in Python
- Collections of tools written in Python
- Windows, Linux or Mac OS X
- Python 2.7
- Pip (Python Package Manager)
- on Linux: Most of the Linux distributions should have installed Python by default
- on Windows: Download Python at: https://www.python.org/downloads/windows/ and run installer
- on Mac OS X: Download Python at: https://www.python.org/downloads/mac-osx/
Executing Python scripts from terminal
- on Linux: Most of the Linux distributions should have enabled Python by default, so simply open terminal and type python to see if everything works.
- on Windows: add
Pathenvironmental variable. Location of the Python directory depends on your configuration. Next, re-run terminal window and type
- in order to check installed version of the Python, type:
- in order to exit python console type
Pip is a Python Package Manager.
Installing Pip on Windows
- Download: https://bootstrap.pypa.io/get-pip.py script
- pip.exe and easy_install.exe files now should be located at: /PythonXX/Scripts (e.g. C:/Python27/Scripts)
- Add /PythonXX/Scripts (e.g. C:/Python27/Scripts) directory into Path environmental variable.
- Re-run terminal window
pip, to check if package manager works
- You can type
pip --version, in order to check version of the pip
Installing Pip on Linux
- Open terminal
sudo apt-get install python-pip
Installing Pip on macOS
- Open terminal
brew install python3
This command will install python and pip.
- In order to install desired package just type
pip install desired_package(e.g.
pip install Flask)
- If you are working on Linux, type
sudo pip install desired_package(e.g.
sudo pip install Flask)
- Index of available packages can be found at: https://pypi.python.org/pypi/
- List of installed packages can be displayed with
- UT in Python can be done with nose. Install it via pip with the following command:
sudo pip install nose
- UT can be also created with unittest package provided with Python.
virtualenv is a tool to create isolated Python environments.
pipenv is Python Development Workflow for Humans.
It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages.
Scripts on Linux
If we want to create a Python script for Linux, we should set the following header:
#!/usr/bin/python -u # your Python script code goes here...
After that when our script was saved in
script.py file, we can execute our script as follows:
Style Guide for Python Code
PEP 0008 is a current Style Guide for Python Code.
Static Code Analysis
- Pytype (by Google)
- Review of Python static code analysis tools
- Awesome static analysis for Python
Python web frameworks
Useful Python libraries
- Requests - HTTP requests for humans
- Httpie - CLI HTTP client
- Python Rex - regular expressions for humans
- PythonVerbalExpressions - readable API for regular expressions
- Envelopes - mailing for human beings
- Tornado - web framework and asynchronous networking library
- Schedule - Python job scheduling for humans
- Agate - data analysis for humans
- Gspread - Google Spreadsheets Python API
- EFILTER (dotty) - a general-purpose destructuring and search language
- Scrapy - web crawling & scraping framework
- sh - Python process launching (llows you to call any program as if it were a function)
- furl - url parsing and manipulation
Tools written in Python
- Wifite - an automated wireless attack tool
- Glances - an Eye on your system
- Pidcat - colored and improved logcat for Android apps
- Caffeine-plus - indicator preventing from turning screensaver/screenlock on
- Spaceship generator - a script for Blender
- neighbourhood - Layer 2 network neighbourhood discovery tool that uses scapy
- Routersploit - The Router Exploitation Framework
- scanless - port scanner
Collections of tools written in Python
- Python Pentest Tools
- awesome-python - curated list of awesome Python frameworks, libraries and software
- one-python - best Python libraries