Store multi-line input into a String (Python)

前端 未结 5 1830
鱼传尺愫
鱼传尺愫 2021-02-06 16:28

Input:

359716482
867345912
413928675
398574126
546281739
172639548
984163257
621857394
735492861

my co

5条回答
  •  长发绾君心
    2021-02-06 17:22

    lines = []
    while True:
    s =input("Enter the string or press ENTER for Output: ")
    if s:
        lines.append(s)
    else:
        break;
    
    print("OUTPUT: ")
    for i in lines:
    print (i)
    
    Input:
    359716482
    867345912
    413928675
    398574126
    546281739
    172639548
    984163257
    621857394
    735492861
    
    Output:
    359716482
    867345912
    413928675
    398574126
    546281739
    172639548
    984163257
    621857394
    735492861
    

提交回复
热议问题