glob.glob output

Hitesh hitesh287 at gmail.com
Mon Mar 12 13:58:37 EDT 2007


import string
import os

f = open ("c:\\servername.txt", 'r')
linelist = f.read()

lineLog = string.split(linelist, '\n')
lineLog = lineLog [:-1]
#print lineLog
for l in lineLog:
    path1 = "\\\\" + l + "\\server*\\*\\xtRec*"
    glob.glob(path1)

When I run above from command line python, It prints the output of
glob.glob but when I run it as a script, it does not print
anything.... I know that there are files like xtRec* inside those
folders.. and glob.glob does spits the path if run from python command
line.

I tried something like this but did not work:
for l in lineLog:
    path1 = "\\\\" + l + "\\server*\\*\\xtRec*"
    xtRec = glob.glob(path1)
    print xtRec

No results...

xtRec = []
for l in lineLog:
    path1 = "\\\\" + l + "\\server*\\*\\xtRec*"
    xtrec = glob.glob(path1)
print xtRec

 No luck here either.

Seems like I am doing here something reallt silly mistake..

Thank you,
hj




More information about the Python-list mailing list