DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Common Directory Tasks

  • submit to reddit
>>> import os
>>> os.getcwd()
>>> os.listdir('C:/lang')
['editplus', 'python23', 'perl', 'ironpy', 'java142', 'processing']
>>> os.chdir('C:/')
This is eqivalent to common task on command line
- Show current directory
- List content in a directory
- Change directory