In python how to read input data like a file from console? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grátis
0

In python how to read input data like a file from console?

3rd Jan 2023, 2:26 PM
Dadaxon Xudayberganov 👑 🇺🇿🇺🇿
Dadaxon Xudayberganov 👑 🇺🇿🇺🇿 - avatar
4 Respostas
+ 7
Dadaxon Xudayberganov 🇺🇿🇺🇿🇺🇿 , it would be helpful if you could make an input sample. > to read from a file, we have to open this file to read the whole content or a part of the content > how will the input from the console should be done? line by line?
3rd Jan 2023, 4:47 PM
Lothar
Lothar - avatar
+ 4
read input from the console like a file you need to import the sys.stdin library This will read each line of input from the console and print it. I hope this helps
3rd Jan 2023, 4:15 PM
╥ YIPMONG Jr ╥
╥ YIPMONG Jr ╥ - avatar
5th Jan 2023, 11:50 AM
╥ YIPMONG Jr ╥
╥ YIPMONG Jr ╥ - avatar
+ 2
Thanks YIPMONG Jr .it is helpful
5th Jan 2023, 11:49 AM
Dadaxon Xudayberganov 👑 🇺🇿🇺🇿
Dadaxon Xudayberganov 👑 🇺🇿🇺🇿 - avatar