Skip to content

socketpy/learn-python-the-hard-way

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn Python - The Hard Way

Overview

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.

Contents

Requirements

  • Windows, Linux or Mac OS X
  • Python 2.7
  • Pip (Python Package Manager)

Installing Python

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 /PythonXX (e.g. C:/Python27) into Path environmental variable. Location of the Python directory depends on your configuration. Next, re-run terminal window and type python
  • in order to check installed version of the Python, type: python --version
  • in order to exit python console type exit()

Pip

Pip is a Python Package Manager.

Installing Pip on Windows

  1. Download: https://raw.github.com/pypa/pip/master/contrib/get-pip.py script
  2. Execute: python get-pip.py
  3. pip.exe and easy_install.exe files now should be located at: /PythonXX/Scripts (e.g. C:/Python27/Scripts)
  4. Add /PythonXX/Scripts (e.g. C:/Python27/Scripts) directory into Path environmental variable.
  5. Re-run terminal window
  6. Type pip, to check if package manager works
  7. You can type pip --version, in order to check version of the pip

Installing Pip on Linux

  1. Open terminal
  2. Type sudo apt-get install python-pip

Installing Pip on macOS

  1. Open terminal
  2. Type brew install python3

This command will install python and pip.

Using 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 pip freeze command.

Unit Testing

  • 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

virtualenv is a tool to create isolated Python environments.

More information:

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:

./script.py

Style Guide for Python Code

PEP 0008 is a current Style Guide for Python Code.

link: https://www.python.org/dev/peps/pep-0008/

Development Environments

Python web frameworks

Web servers

Useful Python libraries

Tools written in Python

Collections of tools written in Python

Resources

Books

License

MIT

About

Set of programs written during learning basics of Python and related resources

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.2%
  • HTML 1.6%
  • Shell 0.2%