Renaming files with Python

I downloaded some PowerPoint slides and wmv programming videos from a college website and the original file names had spaces in them, so my browser’s downloader plugin converted the spaces to _20. I wanted to rename them so they wouldn’t have the _20 in them, and the following is the code I used to do so. Hope someone finds it useful.

import os
import os.path

files = os.listdir(os.getcwd())

for file in files:
    #if '20' and 'wmv' in file:
    if ' ' and 'ppt' in file:
        new_name = file.replace(' ', '_')
        print "%s   %s" % (file, new_name)
        os.rename(file, new_name)

Python Editors: Redux

These notes are mainly for my purposes. I won’t go into enough detail to provide a real review, so check out the links and come up with your own opinion.

After my light testing with Python editors last week, I still had several I hadn’t tried yet. As I did with my last round of testing, I chose to look first for code viewing (class, function, variable, etc) support as my deal breaking feature.

Today I looked at:

Continue reading

Python Editors

This is one of those topics that pretty much everyone that’s done more than a few minutes worth of Python has cared about, at one time or another: Finding a good editor.

I’ve been using Notepad++ for several years now and while it’s good, it’s missing some features I want to start making use of, namely code browsing (class, function, variable).

I started off searching via Google and found both of these pages off of the official Python wiki:

Continue reading

ActivePython license

It suddenly dawned on me yesterday that although the licenses for various modules that Synclosure uses are being respected, I hadn’t closely looked at the license for ActivePython, which comes into play when using cx_Freeze to “wrap” the application and ActivePython together for distribution.

So I checked it:

Continue reading