2017年12月25日 星期一

輸入多行資料

# 輸入多行資料
# get multiline input from user [duplicate]

lines = []
print("請輸入文數字  或按enter結束")
while True:
    line = input()
    if line:
        lines.append(line)
    else:
        break
text = '\n'.join(lines)

print(text)


====================== RESTART: F:/Python_APSC/z001.py ======================
請輸入文數字  或按enter結束
12
2wqwqas
1221
12
12
12

12
2wqwqas
1221
12
12
12
>>> 

沒有留言:

張貼留言

DualGate IoT Access System(雙門物聯網門禁系統)-ESP32 Telegram 智慧門禁控制系統

 DualGate IoT Access System(雙門物聯網門禁系統)-ESP32 Telegram 智慧門禁控制系統 這套整合 ESP32(Wokwi 邊緣端) 、 MQTT Broker ( broker.emqx.io ) 、 Python(中央控制台) 與 Tel...