Jun-02-2018, 01:06 PM
(Jun-01-2018, 01:49 PM)snippsat Wrote:(Jun-01-2018, 12:57 PM)AceScottie Wrote: I never actually define the string manually it's just pulled from os.listdir() so I can't add the r to the start of the stringos.listdir()
just return filename,so why should you addr
(raw string)?
If you build path yourself then canr or \\ or /
just not singel\
because of escape charterer.
Maybe i misunderstand you,so it's better that you post code and explain what's not working.
Here using listdir and open in Notepad default Windows application.
Now i just working from current folder so no path is needed.
>>> import webbrowser >>> import os >>> >>> lst = os.listdir('.') >>> lst ['c.py', 'cpt.py', 'f.py', 'html_env', 'path.py', 'test file.txt'] >>> webbrowser.open(lst[-1]) True
Webbroweser is the best module i was looking for.
it fixes the file name issue and also opens the "open with" window for non associated files
Thansk