m_travis
asked on
File in folder on Windows network share using python
For this question lets say the network share is \\192.168.1.1\d$\testfolde r\
preferred method: Would like to store all the file names in a python list\
other option: Store all the file names to an output.txt file in c:\resultsfolder\
I am using python 3.4 due to getting the script to integrate with tkinter.
preferred method: Would like to store all the file names in a python list\
other option: Store all the file names to an output.txt file in c:\resultsfolder\
I am using python 3.4 due to getting the script to integrate with tkinter.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if you don't use the r you had to escape every backslash which is quite tedious
example:
There is only one exection (in which I fell immediately, when I heard first about the r prefix.
If the last character of a string is a \ , then you have still to escape it.
so
you had to type
example:
r"\\192.168.1.1\d$\testfolder"
is equivalent to"\\\\192.168.1.1\\d$\\testfolder"
which is less readable and more error proneThere is only one exection (in which I fell immediately, when I heard first about the r prefix.
If the last character of a string is a \ , then you have still to escape it.
so
r"c:\"
is invalidyou had to type
r"C:\\"
ASKER
Thank you for the explanation. I also posted the following python question that you might be able to help.
Other python question
Other python question
ASKER
What is the r for?