-2

***what is the value? what is the value? what is the value? what is the value? what is the value?


'''

myfile = open('mytext.text')
"""
 if I print myfile it will not print
 its content I need to use read.() 
 function to read its content

"""
for line in myfile:
    print(line)
"""
  Now my question is why when I use this
  code it prints each line?? I didn't use 
  read.() function, how it reach to the
  content?? Please help me and thanks.
"""
myfile.close()

'''** did you understand? **

Ar.as
  • 31
  • 1
  • 3

1 Answers1

0

There are multiple ways to read from a file other than f.read. Iterating over a file loops over each line in a file.

SuperStormer
  • 4,997
  • 5
  • 25
  • 35