Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

How to read input until EOF in python?

Правка en1, от rgkbitw, 2017-09-01 15:45:26

I came across this problem in UVa OJ. 272-Text Quotes

Well, the problem is quite trivial. But the thing is I am not able to read the input. The input is provided in the form of text lines and end of input is indicated by EOF.

In C/C++ this can be done by running a while loop:

  while( scanf("%s",&s)!=EOF ) { //do something } 

How can this be done in python .?
I have searched the web but I did not find any satisfactory answer.

Please Help Me!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский rgkbitw 2017-09-01 15:45:26 664 Initial revision (published)