“Radio Free Python is a monthly podcast focused on the Python programming language and its community.
- Each episode will start with the news. However, since there isn’t that much breaking news from month to month, this will often veer into a sort of magazine-format news, introducing a specific topic and going over its history as well as current events.
- After the news, each episode will feature an interview with some notable Python luminary.
- Following the interview will be either a Link or Project Highlight, an Editorial, or both, depending on time and inspiration.“
(20131215) This post is out-of-date. BeautifulSoup 4 has built-in support for CSS selectors. Check out this post.
A few days ago I started to explore lxml (it’s been on my list for a long time) and I really like its CSS selector. As I used BeautifulSoup a lot in the past, I wondered if it were possible to add this functionality to BS. I made a quick search on Google and here is what I found: https://code.google.com/p/soupselect/.
“A single function, select(soup, selector), that can be used to select items from a BeautifulSoup instance using CSS selector syntax. Currently supports type selectors, class selectors, id selectors, attribute selectors and the descendant combinator.”
Just what I needed :) You can also patch BS and integrate this new functionality:
>>> from BeautifulSoup import BeautifulSoup as Soup >>> import soupselect; soupselect.monkeypatch() >>> import urllib >>> soup = Soup(urllib.urlopen('http://slashdot.org/')) >>> soup.findSelect('div.title h3') [</pre> <h3>...
For text editing I use vim. When writing Python code and the script is short, vim is OK. However, if it’s a larger project, then I prefer an IDE (PyDev for instance).
sudo apt-get install tcl8.5-dev tk8.5-dev sudo pip install matplotlib
(pip freeze | cut -d = -f 1 | grep -v FIXME | xargs echo | tr ' ' '\n' >list.txt) 2>/dev/null
The list is written to “list.txt”, one package per line. This tip is based upon this thread. This version removes FIXME lines and warnings.
I want to figure out how to upgrade all those packages that I installed via “pip install”. The thread above proposes to execute “pip install -U” on the list of packages. However, it will upgrade every python package, even the ones that were installed with apt-get (or Synaptic, etc.). Apt-get builds a database that contains every file on the system. If “pip install -U” replaces those files, I’m afraid apt-get will panic. This is something to be investigated.