title: How opened file cannot be rewind by seek(0) after using with open() in python
body: <p>While I was trying to print file content line by line in python, I cann't rewind the opened file by <strong>f.seek(0)</strong> to print the content if the file was opened by <strong>with open("file_name") as f:</strong>
  but, I can do this if I use <strong>open("file_name") as f:</strong> 
  then <strong>f.seek(0)</strong></p>
  
  <p>Following is my code</p>
  
  <pre><code>with open("130.txt", "r") as f:             #f is a FILE object
      print (f.read())                        #so f has method: read(), and f.read() will contain the newline each time 
  
  f.seek(0)                             #This will Error!
  with open("130.txt", "r") as f:       #Have to open it again, and I'm aware the indentation should change  
  for line in f:                    
      print (line, end="")          
  
  f = open("130.txt", "r")
  f.seek(0)
  for line in f:
      print(line, end="")
  
  f.seek(0)                           #This time OK!
  for line in f:
      print(line, end="")
  </code></pre>
  
  <p>I am a python beginner, can anybody tell me why?</p>