views:

460

answers:

10

I'm trying to learn Python. I'm going to eventually be using it at work, but I don't have an active project in it as of now. I've been reading through some documentation and would like to learn some basics, but I learn best when actually coding. So I'm thinking of attempting a small Python project just to sort of "get my feet wet" in Python.

While reading/asking around, I've often heard people say that if you need a Python project you should automate some task you do on your computer on a day-to-day basis. Maybe I'm not so imaginative, but I can't think of anything I'd like to automate... Does anyone have any ideas of something simple, fun, and not too time-consuming that someone can automate to get some basic experience in Python? Something that they would come out of feeling like they accomplished something fun and useful?

+1  A: 

I use it to automate DB queries for simple reports, download/move/copy files, and process/analyze data.

ecounysis
+3  A: 

What do you do on a day-to-day basis on your computer. With out knowing that, it is hard to answer this.

Perhaps consider another older bit of programming advice. If you want to really get to know a language, write a game or two.

Aaron
I second the games, there are a wide variety of them and they are usually fun to make. You won't learn much about network though unless you really go all the way and make it work on multiple hosts!
Matthieu M.
+8  A: 
  1. Use Scrapy to automate some data collection task on the web (web scraping)

  2. Use PIL, VideoCapture to automate taking (surveillance) pictures of your home.


manova
+1 for Scrapy - cool tool.
David Wolever
+2  A: 

Automation comes down to making the computer do work that you don't want to do yourself. You want to make it automatically do your work for you!

Take something that you do every day, break it down into steps, and then start automating those steps.

jathanism
+1  A: 

Write a small script in Python that scrapes your laptop's external IP from somewhere like whatismyip.org using the urllib2 module

Then have the script write that IP number to a file, then FTP it somewhere so you can keep track of its location.

Useless if someone wipes your hardrive...but when I did this, I found it a good way to learn basic file i/o as well as utilizing a really useful module ( urllib2 )

CaseyIT
+1  A: 

Create a Twitter stream. It is simple and allows a lot of exposure to the data types in Python and the language itself. You also get to interact with the Twitter API which should give you a feel for how Python can touch the outside world. If this is too simple you can always keep going with it and create a fully fledges client.

Daniel
+2  A: 

Look at this list of code kata exercises for other people's ideas: http://slott-softwarearchitect.blogspot.com/2009/08/code-kata-resources.html

S.Lott
+1 Thanks, that's a nice resource.
Hugh Brackett
A: 

How about something along the way like this. You will learn about user interfaces, the os library / filesystem, threads. Check Chapter 7 of "Visualizing Data" by Ben Fry if you want to get deeper into the UI part (he does not use Python but Processing).

At the moment I use this every day, as my harddisk is nearly full ;)

Roger Metor
+4  A: 

If you have a mp3 (or FLAC) based music collection:

Write a file backup or sync program. Compare the contents of two directories and only backup files that are new or different.

Extend the comparison to include ID3 tags. Use that to sync your music collection across multiple devices. Add flags to copy all files or new(er) files, to copy empty directories or not, to remove files in the destination that are not in the source (or not).

Write a GUI that offers all the options to a user (source and destination directories, pattern to match files and/or dirs, copy option flags, etc). Allow some sets of options to be canned and run as a macro.

Extend the tool to ignore (or fix) tags that differ only by whitespace or capitalization issues.

Extend the tool again to find duplicate music files by comparing ID3 tags and filenames - allow for matches that ignore "A", "The", etc (e.g. "The Beatles" and "Beatles" are the same band).

Extend the tool again to fetch missing ID3 tags from freedb (or amazon, or somewhere else) and update the songs. Have a way to reconcile the tags between different devices by only updating the tags, not copying the whole file.

And so on....

semiuseless
A: 

Ok, a few months later, I'm going to post an answer to my own question... in a superuser post I came across a very, very cute and fun program that I would love to try in Python (although not exactly useful :) ):

Write a program that will turn your computer into a cuckoo clock - by opening and closing the CD tray on the hour and making it play a cuckoo sound once for each hour.

froadie