Showing posts with label python packages. Show all posts
Showing posts with label python packages. Show all posts

Tuesday, April 22, 2008

Adding lots of Python __init__.py files

Lots of subpackages?

import os

names = os.listdir('.')
for name in names:
try:
os.popen('touch %s/__init__.py' % name)
except:
pass

Adds an __init__.py file to every subdirectory.