用 Python实现C的读入方式

来源:互联网 发布:海辉高科软件科技公司 编辑:程序博客网 时间:2024/06/07 07:09
A=[]
N=int(input("N:"))
x=""
tot=0
while True:
    flag=0
    y=x.split(" ")
    for j in y:
        if j!='':
            j=int(j)
            A.append(j)
            tot=tot+1
            if tot==N :
                flag=1
                break
    if flag==1:
        break
    x=raw_input("")
for i in range(0,N):
    print A[i]
原创粉丝点击