python的标准输入输出

1. python2.7的标准输入输出

n = eval(raw_input())
total_list = list()
for i in range(n):
    a,b = raw_input().split()
    temp_list = list()
    temp_list.append(a)
    temp_list.append(b)
    total_list.append(temp_list)

row = len(total_list)
col = len(total_list[0])
for i in range(row):
    row_list = total_list[i]
    for j in range(col):
        print row_list[j],
    print





2. python3.4 的标准输入输出

n = eval(input())
total_list = list()
for i in range(n):
    a,b = input().split()
    temp_list = list()
    temp_list.append(a)
    temp_list.append(b)
    total_list.append(temp_list)

row = len(total_list)
col = len(total_list[0])
for i in range(row):
    row_list = total_list[i]
    for j in range(col):
        print(row_list[j],end = " ")
    print()





参考:《python学习手册》311-314页





posted @ 2017-09-17 18:27  banlucainiao  阅读(63)  评论(0)    收藏  举报