Open text file either locally or remotely via url with python -
I am working on a project where I need to read and read text files on a local server or remotely Url). Is there a Python function that works like php:
  file_get_contents ()    Can you do this? I have now:  
  def get_data_from_file (path): for i, line in enumerate (open): .....    I want to pass in a local or remote way in some way.   
 
  You can try:  
  def file_get_contents (path) : Try: excluding urllib.urlretrieve (path, file name = path): Print 'no one page' if os.path.exists (path): Open (Path, R) with file as: data = file. read () print data other: print 'no such file'    
 
  
Comments
Post a Comment