getting files from a windows network

Chris Liechti cliechti at gmx.net
Mon Jun 10 19:50:31 EDT 2002


sameer_ at email.com (sameer) wrote in 
news:6bd9f01b.0206101523.7af66fc8 at posting.google.com:
> is there a way to read files in python that are found on a windows
> network, i.e. files that users choose to share on their computers on a
> windows network.

do you mean by e.g.
>>> open(r'\\computername\share\test.txt').read()

yes :-)

( r'' is a raw string that doesn't touches backslashes unlike normal 
strings)

if you want a list of computers you can use:
>>> map(str.strip, os.popen("net view").readlines()[3:-2])

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list