I am using: Notepad++, Python 3.4, Windows 7
I've got the following problem: If I want (for example) to open a file. I always have to put in the whole path for example "C:\\Python34\\05_Python_Project\\Python_von_Kopf__\\chapter7\\webapp-chapter7\\cgi-bin\\some_file.txt"
I want to a write just a short filename like:
with open ('some_file.txt') as footer_d:
...
I realise that Notepad++ is searching in the following path: "C:\\Program Files (x86)\\Notepad++"
Can I somehow change/ configure Notepad++ for searching at the file location???
A very simple way to implement this, is to do it all in Python:
import os
os.chdir("C:/Python34/05_Python_Project/Python_von_Kopf__/chapter7/webapp-chapter7/cgi-bin")
(The Windows API is quite happy with forward slashes as a path separator. It's command line applications that tend not to like them.) Alternatively:
dirlist = ["C:\\", "Python34", "05_Python_Project", Python_von_Kopf__",
"chapter7", "webapp-chapter7", "cgi-bin"]
dir = os.path.join(*dirlist)
os.chdir(dir)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.