python常用功能配置

2021-10-10 17:17:29 字數 3103 閱讀 7468

參看存在的虛擬環境

conda evn list
創造虛擬環境

conda create -n 環境名 python=3.6
刪除虛擬環境操作

conda remove -n 環境名 --all
啟用環境

activate 環境名
安裝jupyter

conda install jupyter
jupyter預設配置

jupyter notebook --generate-config --allow-root

vim /home/xjl/.jupyter/jupyter_notebook_config.py

conda install nb_conda
啟動jupyter

常用指令如下:命令模式 (按鍵 esc 開啟)快捷鍵:

enter : 轉入編輯模式

shift-enter : 執行本單元,選中下個單元

ctrl-enter : 執行本單元

alt-enter : 執行本單元,在其下插入新單元

y : 單元轉入**狀態

m :單元轉入markdown狀態

r : 單元轉入raw狀態

up : 選中上方單元

k : 選中上方單元

down : 選中下方單元

j : 選中下方單元

shift-k : 擴**中上方單元

shift-j : 擴**中下方單元

a : 在上方插入新單元

b : 在下方插入新單元

x : 剪下選中的單元

c : 複製選中的單元

shift-v : 貼上到上方單元

v : 貼上到下方單元

z : 恢復刪除的最後乙個單元

d,d : 刪除選中的單元

shift-m : 合併選中的單元

ctrl-s : 檔案存檔

s : 檔案存檔

l : 轉換行號

o : 轉換輸出

shift-o : 轉換輸出滾動

esc : 關閉頁面

q : 關閉頁面

h : 顯示快捷鍵幫助

i,i : 中斷notebook核心

0,0 : 重啟notebook核心

shift : 忽略

shift-space : 向上滾動

space : 向下滾動

編輯模式 ( enter 鍵啟動)下快捷鍵

tab : **補全或縮排

shift-tab : 提示

ctrl-]

: 縮排

ctrl-[

: 解除縮排

ctrl-a : 全選

ctrl-z : 復原

ctrl-shift-z : 再做

ctrl-y : 再做

ctrl-home : 跳到單元開頭

ctrl-up : 跳到單元開頭

ctrl-end : 跳到單元末尾

ctrl-down : 跳到單元末尾

ctrl-left : 跳到左邊乙個字首

ctrl-right : 跳到右邊乙個字首

ctrl-backspace : 刪除前面乙個字

ctrl-delete : 刪除後面乙個字

esc : 進入命令模式

ctrl-m : 進入命令模式

shift-enter : 執行本單元,選中下一單元

ctrl-enter : 執行本單元

alt-enter : 執行本單元,在下面插入一單元

ctrl-shift-- : 分割單元

ctrl-shift-subtract : 分割單元

ctrl-s : 檔案存檔

shift : 忽略

up : 游標上移或轉入上一單元

down :游標下移或轉入下一單元

1.conda install 報錯

終端下分別輸入

conda config --add channels 

conda config --add channels

conda config --add channels

conda config --set show_channel_urls yes

或者去資料夾c:\user\你的使用者名稱\.condarc下修改為上面的鏈結

2. 安裝nb-conda報錯

這裡需要更新jupyter

終端下輸入

conda update jupyter_core jupyter_client

python 常用功能

sintance和type class foo object pass class bar foo pass obj bar isinstance用於判斷,物件是否是指定類的例項 錯誤的 isinstance用於判斷,物件是否是指定類或其派生類的例項 isinstance不精準 print isin...

Python常用功能函式

1.字串反轉 字串反轉 string 字串變數 staticmethod def str reverse string result string 1 return result 2.刪除首尾指定的字元 刪除首尾指定的字元 string 字串變數 rm 要刪除的字元,預設為空格 staticmeth...

python常用功能總結

經常寫python,但很多小的點都記不住,每用必查,總結下來,下次查自己的吧。1.時間獲取 import time print time.strftime y m d h m s time.localtime time.time 結果 2016 10 10 22 25 26 2.http傳送post...