[英]How to open notepad++ of a file ON A CERTAIN LINE?
I am writing a python script that is suppose to open a txt file via Notepad ++ ON A CERTAIN LINE.我正在编写一个 python 脚本,该脚本假设通过 Notepad ++ 在某条线上打开一个 txt 文件。 This is my code but it allows me just to open the file on the first line.这是我的代码,但它只允许我在第一行打开文件。
def open_notepad():
subprocess.call([
r"C:\Program Files\Notepad++\notepad++.exe",r"path_to_file.txt"
])
You can add arguments to your call to notepad++.exe
.您可以将 arguments 添加到对notepad++.exe
的调用中。 In your case you would need to add -n
and then an integer.在您的情况下,您需要添加-n
,然后添加 integer。
For example:例如:
subprocess.call([
"C:\Program Files\Notepad++\notepad++.exe", "-n", str(line_number), file_path
])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.