Reading files located on Windows-shares?

Thomas Weholt thomas at gatsoft.no
Mon Jan 28 12:58:49 CET 2002


I need to read a specific file located on several shared folders on specific
machines on a Windows-based network.

I got a list of machines, which have all shared the folder 'data':

hosts = ['foo1','foo2','bar1','bar2']

In Windows Explorer I'd access these folders by just typing
\\machinename\sharedfolder in the location-field.

Doing something like :

for host in hosts:
    print open('\\%s\\data\config.dat', 'r').read()

Doesn't work. How can I work with Windows-shared folders using Python ??

Best regards,
Thomas Weholt






More information about the Python-list mailing list