[TOC]
<br>
### 交互式輸入 input()
input 函數,接收交互式輸入,格式如: *input(prompt=None, /)*
**關鍵參數**
*prompt:* 輸入提示信息
效果如:
```cmd
>>> input("請輸入您的昵稱:")
請輸入您的昵稱:
```
#### 將輸入值賦予一個變量
```cmd
>>> name=input("請輸入您的昵稱:")
請輸入您的昵稱:Milton
>>> name
'Milton'
>>> age=input("請輸入您的你年齡:")
請輸入您的你年齡:18
>>> age
'18'
>>> type(age)
<class 'str'>
```
>[warning] 請注意:所有的輸入,被接收后都會變成字符串類型
>
### 程序打印輸出 print()
print 函數,用于在控制臺中打印,格式如:
*print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)*
效果:
```cmd
>>> print("Hello,World")
Hello,World
>>>
>>> print(1+1)
2
>>>
>>> print("Hello","World")
Hello World
>>>
>>> person={'name':'Milton','age':18}
>>> print(person)
{'name': 'Milton', 'age': 18}
>>>
```
#### 指定分隔符 sep
sep: 分割符,默認空格
```cmd
>>> print("Hello","World",sep="*")
Hello*World
```
#### 指定結束符 end
end:打印后的結束方式,默認為換行符\n
```cmd
>>> for name in ['Milton','Cherish']:
... print("name=",name)
...
name= Milton
name= Cherish
>>>
```
如果指定end結束符,則如下:
```cmd
>>> for name in ['Milton','Cherish']:
... print("name=",name,end=";")
...
name= Milton;name= Cherish;
```
<hr style="margin-top:100px">
:-: 
***微信掃一掃,關注“python測試開發圈”,了解更多測試教程!***
- 前言
- chapter01_開發環境
- chapter02_字符串的使用
- chapter03_列表的使用
- chapter04_字典的使用
- chapter05_數字的使用
- chapter06_元組的使用
- chapter07_集合的使用
- chapter08_輸入輸出
- chapter09_控制流程
- chapter10_實例練習_登錄1
- chapter11_python函數入門
- chapter12_python中的類
- chapter13_輕松玩轉python中的模塊管理
- chapter14_掌握學習新模塊的技巧
- chapter15_通過os模塊與操作系統交互
- chapter16_子進程相關模塊(subprocess)
- chapter17_時間相關模塊(time & datetime)
- chapter18_序列化模塊(json)
- chapter19_加密模塊(hashlib)
- chapter20_文件的讀與寫
- chapter21_階段考核2_登錄
- chapter22_小小算法挑戰(排序&二分法)
- chapter23_用多線程來搞事!
- chapter24_HTTP接口請求(requests)
- chapter25_接口測試框架(pytest)
- chapter26_階段考核3_HTTP接口測試
- chapter27_HTML解析(pyquery)
- chapter28_階段考核4_爬蟲下載網易汽車
- chapter29_python中的那些編碼坑
- chapter30_MySQL數據庫操作
- chapter31 高級特性_迭代器與生成器
- chapter32 高級特性_裝飾器
- chapter33 高級特性_列表處理