3.3 字符串輸入

字符串輸入

以前在學習input的時候,經過它可以完成從鍵盤獲取數據,而後保存到指定的變量中;學習

注意:input獲取的數據,都以字符串的方式進行保存,即便輸入的是數字,那麼也是以字符串方式保存spa

demo:code

    userName = input('請輸入用戶名:')
    print("用戶名爲:%s" % userName)

    password = input('請輸入密碼:')
    print("密碼爲:%s" % password)

結果:(根據輸入的不一樣結果也不一樣)blog

    請輸入用戶名:itheima
    用戶名爲: itheima
    請輸入密碼:haohaoxuexitiantianxiangshang
    密碼爲: haohaoxuexitiantianxiangshang
相關文章
相關標籤/搜索