You are attempting to open a file containing a list of integer numbers, each on a separate line, and read them into Python as int types. What statement could you use to do this, assuming each line is represented by the line variable in a continuous loop?

Respuesta :

Answer:

The answer to this question can be given as:

Statement:

number = int(line.strip())

Explanation:

In the above statement, we declare an integer variable number accept the integer value from the file that name is line. In this line, we use the strip() function. This function returns a duplicate string with both starting and tracking characters removed (based on the string parameter passed). The strip() function removes characters from both sides (left and right) based on the parameter(a string defining the collection of characters to be removed).