getting files from a windows network

Peter Hansen peter at
Mon Jun 10 23:55:11 EDT 2002

Chris Liechti wrote:
> sameer_ at (sameer) wrote in
> news:6bd9f01b.0206101523.7af66fc8 at
> > 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)

Or slightly simpler, just use forward slashes all the time:

>>> open('//computername/share/test.txt').read()

Except for at the DOS command line, Windows generally likes
forward slashes pretty well.


More information about the Python-list mailing list