摘要
本文主要介绍一些算法笔试过程中的几个输入输出python语句的代码格式
- [x] Edit By Porter, 积水成渊,蛟龙生焉。
 
 字符串型
 单行输入
1 2 3
   | import sys line = sys.stdin.readline().strip() print(line)
   | 
 多行输入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
   | import sys if __name__ == "__main__":     data=[] while True:     line = sys.stdin.readline().strip()     if not line:         break     data.append(line) print("-".join(data))   比如输入 1   2   3 输出:1-2-3
   | 
 数值型
 输入数字
 单行输入输出为数组
1 2
   | l=list(map(int,input().split(" "))) print(l)
  | 
 输出形式为矩阵
1 2 3 4 5 6 7 8 9 10
   | import sys if __name__ == "__main__":     data=[] while True:     line = sys.stdin.readline().strip()     if not line:         break     tmp = list(map(int, line.split(" ")))     data.append(tmp) print(data)
   |