This example deals primarily with pulling option values out of select boxes, and should be much easier to understand than my last, somewhat convoluted Beautiful Soup example. However, much like the previous example, this one stemmed from a “real world” need. I’m talking about trying to find a bargain vacation on the super slow website, […]
Archive for the Python category:
In 2008 I started learning Python (with *a lot* of help from David Beazley, thank you good sir!). I can’t get enough. Here I discuss what I’m learning, and eventually, how it applies to the web.
Using Python and os.walk to Locate the Firefox Cache
My series of Beazley-related Python lessons picks up again here. This is actually a small part of a bigger assignment, which was to decode the files within a user’s Firefox cache (coming later), but this nice little script can be handy to find about anything on your system with Python.
Every Firefox cache contains a file […]
Parsing and Calculating Data with Python and CSV Files
I’ve recently wrapped up a Dynamic Languages class, taught by David Beazley. Being a Python guru, this sorta turned into a Python class, but I had no problem with that. With Dave’s permission, I’ll be posting a few of the lessons here, as well as their solutions. I’ve already posted the first assignment and a […]
Textmate & Running Python Scripts in Interactive Mode
So yeah, as I check out Emacs, I also checkout things in Textmate that I might not know about, and I’m learning that Textmate can do *lots* more cool stuff than I thought it could. One of those is (yes!) Textmate does have Python debugging built in (both PyCheckMate as well as the standard Python […]
Launch IDLE on Default Leopard Installation
Yes, IDLE is installed on Leopard - you just need to launch it from the command line.
Beautiful Soup - Example 1
I’m finding The Soup to be extremely useful for turning static HTML sites into dynamic, database driven sites. For example, scraping the desired html data, dumping it into a CSV file, and importing it into MySQL. Here’s one “real-world” example of how to do that.
Putting Python on the Web
The more I use Python, the more I think about using it online. Often this amounts to creating simple tools to help me get things done quicker, like embed a simple script in a web page, process a form, etc. without having to install an entire framework. Besides, it’s handy having the basics of Python […]
Getting MySQL-python Running on Leopard
As I pursue my python adventures, I of course wanted to learn how to do one of the things I do most - pull data out of MySQL. It seems the simplest way to start doing that is Python is to use MySQL-Python. So, after a downloading the package from SourceForge, and following the […]
Get TextMate to Recognize More Python Keywords
Syntax highlighting is definitely your friend when you’re coding, and while I love TextMate, it’s support for some languages is still a bit lacking.
For reference, you can always get my current customized theme(s) here. You can browse more themes at the Textmate Wiki.
Fortunately, it’s rather easy to customize the language packs. Here’s what I did […]
Basic File Parsing with PHP and Python
I’m currently taking a masters class on dynamic languages with DaBeaz, and our first assignment was to parse a basic text file containing a stock portfolio, like so (here’s a simple text file w/ all of them):
YHOO 50 19.25
AAPL 100 143.41
SCOX 500 4.21…
The values are symbol, shares, and price. We had to produce a nicely […]