import os or import os.path

Discussion in 'Python' started by Jabba Laci, Sep 6, 2011.

  1. Jabba Laci

    Jabba Laci Guest

    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
    Jabba Laci, Sep 6, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Keith-Earl
    Replies:
    1
    Views:
    1,968
    Peter O'Reilly
    May 3, 2004
  2. Replies:
    0
    Views:
    2,244
  3. Mupota Muchelemba
    Replies:
    1
    Views:
    906
    Tony Morris
    Feb 4, 2004
  4. Matt
    Replies:
    3
    Views:
    19,543
    Sudsy
    Jul 8, 2004
  5. James
    Replies:
    2
    Views:
    13,920
    Andrew Thompson
    Dec 7, 2004
Loading...

Share This Page