Skip to content

Instantly share code, notes, and snippets.

@lyndametref
Last active September 5, 2016 10:59
Show Gist options
  • Save lyndametref/4bd8526b0a1aa5f9491ba8d0add45ec2 to your computer and use it in GitHub Desktop.
Save lyndametref/4bd8526b0a1aa5f9491ba8d0add45ec2 to your computer and use it in GitHub Desktop.
Pyhton3 cheatsheet
import urllib.request
url = 'http://abc.net/file.html'
html = urllib.request.urlopen(url).read()

Install virtualenv

https://packaging.python.org/installing/#creating-virtual-environments

3.3+ built-in. In Ubuntu:

sudo apt-get install python3-venv

can be added to 2.6+/3.1+ :

pip install virtualenv

Create new virtualenv specifying which version of Pyhton using

3.3+: python3 -m venv my_venv_path

activate the virtualenv

source my_venv_path/bin/activate

deatctivate virtualenv

deactivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment