Last active
December 2, 2021 14:19
-
-
Save ellygaytor/451d21538e51f791fdf0f39c3658d978 to your computer and use it in GitHub Desktop.
Allow multi-line input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def multi_input(prompt = None): | |
lines = [] | |
while True: | |
line = input(prompt) | |
if line: | |
lines.append(line) | |
else: | |
break | |
output = '\n'.join(lines) | |
return output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def multi_input_list(prompt = None): | |
lines = [] | |
while True: | |
line = input(prompt) | |
if line: | |
lines.append(line) | |
else: | |
break | |
return lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment