input在python中的使用注意
1、函式input()接受一個引數,即要向使用者顯示的提示或說明,讓使用者知道該如何做。在這個示例中,使用者將看到提示Tell me something, and I will repeat it back to you:。程式等待使用者輸入,並在使用者按Enter鍵後繼續執行。
輸入儲存在變數message中,接下來的print(message)將輸入呈現給使用者:
Tell me something, and I will repeat it back to you: This is Fulade! This is Fulade!
2、使用函式input()時,應指定清晰而易於明白的提示,準確地指出你希望使用者提供什麼樣的資訊——指出使用者該輸入任何資訊的提示都行,如下所示:
name = input("Please enter your name: ") print("Hello, " + name + "!")
以上就是input在python中的使用注意,希望能對大家有所幫助。更多Python學習指路:
本文教程操作環境:windows7系統、Python 3.9.1,DELL G3電腦。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2480/viewspace-2830484/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- python中__new__的使用注意Python
- python中input()與raw_input()的區別Python
- python中smtplib使用注意點Python
- python中的input是什麼Python
- Python2 中 input() 和 raw_input() 的區別Python
- Python中Lambda使用要注意的幾個地方Python
- getopt在Python中的使用Python
- reload在python中的使用Python
- JSON在Python中的使用JSONPython
- sqlalchemy在python中的使用(基本使用)一SQLPython
- sql中的*的使用注意點SQL
- python字典合併的使用注意Python
- python私有方法的使用注意Python
- Python -- raw_input() and input() -- ACMPythonACM
- AES演算法在Python中的使用演算法Python
- python input 使用和字串格式化Python字串格式化
- 在GlassFish的WebService中需要注意的HashMapWebHashMap
- 在 HttpHandler 中使用 Session 的注意事項HTTPSession
- python預設引數的使用注意Python
- python類裝飾器的使用注意Python
- 在js中獲取 input checkbox裡選中的多個值JS
- java中Stream的使用流程及注意Java
- 快取使用中的注意事項快取
- Mock 在 Python 單元測試中的使用MockPython
- button 和input 的區別及在表單form中的用法ORM
- rman 中的 delete all input 和 delete input 的區別delete
- Python Enum 使用的幾點注意事項Python
- python中math.log注意點Python
- Python中__init__方法注意點Python
- sqlalchemy在python中的使用(關於查詢)二SQLPython
- Python爬蟲之路-chrome在爬蟲中的使用Python爬蟲Chrome
- ThinkPHP中CURD where的使用注意事項PHP
- Linux中fork的使用注意事項Linux
- jquery 中$("form :input") $("form input") 區別jQueryORM
- Rman 中的delete input的用法delete
- 在PHP中使用類可能需要注意的地方PHP
- Python input()函式:獲取使用者輸入的字串Python函式字串
- 使用 Beautiful Soup 在 Python 中抓取網頁Python網頁