2
In PHP, we have a function called file
which, when opening a file, causes each line to be placed in an item of a array
.
Example:
hello.txt
olá
mundo
php script
file('hello.txt'); // array('olá', 'mundo')
In Python, how could I read each line of file into an item of a list
or tuple
?
There is a simple way as it is done in PHP?