import os or import os.path

Jabba Laci jabba.laci at gmail.com
Tue Sep 6 23:25:32 CEST 2011


Hi,

If I want to use the 'os.path' module, it's enought to import 'os':

import os
if os.path.isfile('/usr/bin/bash'):
    print 'got it'

In other source codes I noticed that people write 'import os.path' in
this case. Which is better practice?

Thanks,

Laszlo



More information about the Python-list mailing list