[問題] Jupyter lab自動換行對齊

作者: filialpiety (filialpiety)   2019-08-28 16:48:34
抱歉!新手上路
這是按enter enter下去的程式碼
def test_empty(x):
if len(x) ==0:
print("empty")
else:
print("not empty")
test_empty(A)
然後結果執行錯誤
這是我手工對齊的程式碼
def test_empty(x):
if len(x) ==0:
print("empty")
else:
print("not empty")
test_empty(A)
然後結果可以執行
想請問有無方法讓她自動對齊呢?才不會因為這樣的問題無法執行
感謝萬分
作者: papple23g (逆道者)   2019-08-28 20:56:00
一般還是習慣到else時按Shift+Tab不介意其他編輯器的話,Visual Studio Code的Python Indent插件有這個功能https://marketplace.visualstudio.com/items?itemName=KevinRose.vsc-python-indent這是官方範例動畫(第13行處的elif)https://i.imgur.com/BazjrmM.gif
作者: ruokcnn (Dean)   2019-09-01 01:01:00
Jupyter沒有variable explorer真的是有一點點不便

Links booklink

Contact Us: admin [ a t ] ucptt.com