My Python howtos

Here is a collection of short articles I have written about how to do many useful things in Python.

Tip - How to use pip, git and PyCharm behind a proxy

Sometimes I need to use pip, git, twine and PyCharm behind a proxy, and I have to look up how to configure them. Here's a quick cheat sheet:


The proxy needs to be provided on the command line each time you run pip, as follows:

pip install --proxy http://proxyserver:port <package>

If you need authentication:

pip install --proxy http://user:password@proxyserver:port <package>


The proxy can be set in the configuration using this command:

How to package a Python app and the Python interpreter in a single EXE

This article describes solutions to create a single executable file containing a Python application/script and the Python interpreter DLL with all necessary libraries. The executable file can then be launched on any system even if Python is not installed.

How to create network servers in Python (HTTP, FTP, SMTP, SOAP, syslog, ...)

This article lists solutions to create network servers in Python for different standard protocols: HTTP, FTP, SMTP, SOAP, syslog, WebDAV, ...

How to obtain the binary representation of an integer in Python

With Python 2.6+, that's quite simple:

print "{0:b}".format(i)

Python crash course

This is a Python course I have written to quickly teach Python to my colleagues and students, made of slides and samples for hands-on exercises.

How to run Ruby code from Python (Python-Ruby bridge)

There are several solutions if you need to run Ruby code from Python. It may be useful when you find an interesting Ruby module which has no equivalent in Python.

Python tips - How to easily convert a list to a string for display

There are a few useful tips to convert a Python list (or any other iterable such as a tuple) to a string for display.

A mini Python tutorial

Here is a mini Python tutorial, for people who want to quickly learn Python basics. It also provides links to more detailed documentation. Since January 2010, a more complete Python crash course is also available, with slides and samples.

ElementTree and lxml for pythonic XML processing in Python

ElementTree is a "pythonic" XML parser interface developed by Fredrik Lundh which is included in the Python standard library since version 2.5. It provides a very simple and intuitive API to process XML (well, much simpler and more intuitive than usual parsers). lxml is a more efficient parser with a compatible interface. Here are some useful tips to use ElementTree and lxml.

Syndicate content