[英]python don't save files in visual studio code
我昨天開始使用 Visual Studio 代碼,但我遇到了這個問題......
假設我有這個代碼:
myFile = open("file.txt", "w+")
myFile.write("something \n")
myFile.close()
當我在 VScode 上運行它時,它不會保存文件,但是當我在 SublimeText 中運行它時它會保存。
你知道如何解決嗎? 我沒有找到任何東西(或者我不知道如何搜索),我的 launch.json 看起來像這樣:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "internalConsole"
}
]
}
**在我寫完之后,我注意到它將文件保存在“C:\Users\User\Documents\vsprofiles”中,但是我的桌面上有 my.py 文件,我希望它將文件保存在相同的路徑中.py 文件就像 SublimeText 一樣。
為了完整起見,這是我的配置文件
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"cwd": "${fileDirname}",
"env": {},
"pythonArgs": [],
"stopOnEntry": false
}
]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.