On 2016-04-19 23:38, Chris Angelico wrote:
On Wed, Apr 20, 2016 at 8:29 AM, Seymore4Head <[email protected]> wrote:handle = open("\\Winmx\New$\q.txt") for line in handle: line=line.strip() print line Traceback (most recent call last): File "\\Winmx\New$\add viewed.py", line 2, in <module> handle = open("\\Winmx\New$\q.txt") IOError: [Errno 2] No such file or directory: '\\Winmx\\New$\\q.txt' What I would like to do is read a plain text file from a hidden network drive and append a space and the * character to the end of each line.Start with this: print("\\Winmx\New$\q.txt") If that doesn't do what you expect, it's possibly because you want to use a raw string literal to prevent the backslashes from being parsed. handle = open(r"\\Winmx\New$\q.txt") That might help you. (One clue that this is happening is that some of your backslashes got doubled in the error message.)
when printed out: >>> print "\\Winmx\New$\q.txt" \Winmx\New$\q.txt That's a file 2 directories down on the current drive. -- https://mail.python.org/mailman/listinfo/python-list
