Search code examples
pythonvariables

what type of variable is one that opens a file?


I know that if a variable is a word then it is a string. If it has numbers it is a float.

What type of variable would it be if it opens a code. Here is my code:

problem = open('problems.txt')
lines=problem.readlines()

Solution

  • You need to use

    type(problem)
    

    Which gives you :

    <type 'file'>