Python 3: How to ignore line breaks when using input()
问题 while count != 5: input_text = input("Please insert a number of lines of text \n") if count != 5: print("Count is " + str(count)) For the code above, when prompted to supply input, if I paste in a text with multiple line breaks. The code will run for the number of line breaks! I just want it to run ONCE for the entire text. Can anyone help? 回答1: You can use sys.stdin.read() but it will require you to manually send the EOT character: >>> import sys >>> x = sys.stdin.read() the quick brown fox