我昨天開始使用 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”中,但我在桌面上有我的 .py 檔案,我希望它把檔案保存在相同的路徑中.py 檔案就像 SublimeText 一樣。
uj5u.com熱心網友回復:
為了完整起見,這是我的組態檔
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"cwd": "${fileDirname}",
"env": {},
"pythonArgs": [],
"stopOnEntry": false
}
]
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/369003.html
上一篇:如何在python中比較兩個日期
