How do I read multiple lines of raw input in Python?

后端 未结 9 1430
礼貌的吻别
礼貌的吻别 2020-11-22 09:28

I want to create a Python program which takes in multiple lines of user input. For example:

This is a multilined inp         


        
9条回答
  •  情话喂你
    2020-11-22 09:47

    Its the best way for writing the code in python >3.5 version

    a= int(input())
    if a:
        list1.append(a)
    else:
        break
    

    even if you want to put a limit for the number of values you can go like

    while s>0:
    a= int(input())
    if a:
        list1.append(a)
    else:
        break
    s=s-1
    

提交回复
热议问题