# [筆記] Jupyter Notebook 吃 user input 的方法
> [name=Tao]
###### tags: `Python`
### 不囉唆,直接來個範例!
以下是用 python3 的做法
```python
from IPython.display import clear_output
user_input = ''
while user_input != 'q': # 當 user 輸入 q 時跳出去!
user_input = input('enter cmd: ')
if user_input=='clear': # 當 user 輸入 clear 時
clear_output(wait=False) # 立即清空目前 cell 的內容
else:
print(f"user_input: {user_input}")
```
* 使用 input() 來吃 user 的輸入
* 使用 from IPython.display 裡面的 clear_output 來清空 cell
### Demo
當我輸入 clear 時

按下 enter 後的效果

輸入 q 結束
