VSCode-python 進階配置

來源:互聯網
上載者:User

標籤:vim   內容   default   識別   ike   icons   亂碼   system   last   

VSCode-python 進階配置中文亂碼

中文亂碼,網上一堆解決方案,但是根本沒有有效起作用的。
在python指令碼的前面添加:

# -*- coding:utf-8 -*-

並不能在控制台輸出時是的print輸出中文不亂碼。但是此時os.system()的輸出卻是正常的,
如果使用調試進行輸出得到相反的結果:print輸出正常,但是終端輸出亂碼。

解決方案:盡量不要用中文
好吧,確實沒卵用!哪位小夥伴有解決方案,請不吝賜教。

自動添加文首注釋

此時需要安裝vscode-fileheader
安裝後需要進行相關配置:
檔案 ——> 喜好設定 ——> 設定
開啟setting.json,搜尋fileheader,找到以下設定:

  // By default, create file  username  "fileheader.Author": "mikey.zhaopeng",  // By default, common template. Do not modify it!!!!!  "fileheader.tpl": "/*\r\n * @Author: {author} \r\n * @Date: {createTime} \r\n * @Last Modified by:   {lastModifiedBy} \r\n * @Last Modified time: {updateTime} \r\n */\r\n",  // By default, update file  username.  "fileheader.LastModifiedBy": "mikey.zhaopeng",

然後變更:

    // By default, create file  username 此處更改為你的使用者名稱    "fileheader.Author": "Yanta",     // By default, common template. Do not modify it!!!!!      "fileheader.tpl": "#!/usr/bin/env python \r\n# -*- coding:utf-8 -*- \r\n‘‘‘\r\n * @Author: {author} \r\n * @Date: {createTime} \r\n * @Last Modified by:   {lastModifiedBy} \r\n * @Last Modified time: {updateTime} \r\n * @Desc: \r\n‘‘‘\r\n",      // By default, update file  username. 此處更改為你的使用者名稱    "fileheader.LastModifiedBy": "Yanta",    "workbench.iconTheme": "vscode-icons"

更改過上述配置之後需要重啟vscode,否則不會應用更改。
重啟後建立立檔案,按下快速鍵:Ctrl+Alt+i,就會在指令碼開頭自動填入注釋內容。

不足

file-header目前無法自動添加註釋部分,而且無法想vim一樣可以自動識別指令碼類型,然後自動插入對應的文首注釋。
注釋只能針對所有的指令檔一視同仁。

檔案表徵圖

增加檔案表徵圖外掛程式,實際上就是為了好看。
直接搜尋:vscode-icons安裝即可。

VSCode-python 進階配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.