With the help of
fileinput.input() method, we can get the file as input and to can be used to update and append the data in the file by using
Return : Return the data of the file.
Example #1 :
In this example we can see that by using
fileinput.input() method, we are able to get the data of the file line by line by using this method.
Input File –
Example #2 :
Input Files –
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course