Prefetch Technologies // Keeping your cache lines cozy

Archive

Posts in Python

Reading a file into a Python string

pythonJan 30, 2012 1 min read

I've learned a number of useful things from the Google learn Python video series. One of the tips I got to use today. That tip was Python's ability to read a file into a string: This has a few interesting uses, and I plan to put this to use this weekend when I finish up a Python project I'm working on. I really, really dig Python…

$ read more →

Learn Python video series from Google

pythonJan 22, 2012 1 min

I've been trying to expand my Python knowledge and recently came across Nick Parlante's 6-part learn Python series on Youtube. I've watched several of the videos, and I am impressed with Nick's teaching ability. Here are links to the 6-part series: Day 1 part 1: Introduction and Strings: Watch on YouTube Day 1 part 2: Lists, Sorting and Tuples: Watch on YouTube Day 1 part 3: Dicts and Files: Watch on YouTube Day 2 part 1: Regular Expressions: Watch on YouTube Day 2 part 2: OS and Commands Watch on YouTube Day 2 part 3: URLs, HTTP and Exceptions Watch on YouTube If you are looking to learn Python this is a great place to start!

$ read more →

Serve out content over HTTP from your cwd immediatly

pythonshellOct 31, 2009 1 min

Ever want to immediatly serve content from a specific directory over HTTP, but didn't want to bother messing with httpd.conf or other webserver configiurations? If you've got Python installed, this is a snap. Execute python with the SimpleHTTPServer module, using port 8080 so there isn't a need to elevate privs to root. Sure enough, pointing a browser to the IP address :8080 of the box hits my home directory listing…

$ read more →

Accessing the Python help facility from the Python shell

pythonJun 25, 2009 1 min

Python has a ton of useful modules, and the built-in help facility is extremely useful for gaining quick access to a description of methods in a given module. Once a module is imported with import: To get help on a specific method, you can pass the module and method name to the built-in help function: This is pretty sweet, and makes coding in Python super easy.

$ read more →

Installing Python modules with easy_install

pythonJun 21, 2009 2 min

I have been spending some of my spare time reading Learning Python and experimenting with various Python modules. One of the cool things about the Python modules facility is easy_install, which allows you to install modules from local files or a remote location. To install a module from a local directory, you can pass the name of the module to easy_install: To install from a network location, you can pass a URL with the location of the module to easy_install: You can also pass the name of a module to easy_install: Which will cause easy_install to search the Python package index, and install the module based on information in the package index. I loves me some Python!

$ read more →