.web/utils/__init__.py
def open_if_exists(filename, mode='rb', encoding='utf-8'):
  """Returns a file descriptor for the filename if that file exists, otherwise ``None``."""
  if not os.path.isfile(filename) and (mode.rfind('r') != -1 or mode.rfind('a') != -1):
    return None
  try:
    import codecs
  except ImportError:
    try:
        return open(filename, mode=mode, encoding=encoding)
    except ValueError:
        return open(filename, mode=mode)#_io.BufferedReader
  else:
    return codecs.open(filename, mode)
Returns a file descriptor for the filename if that file exists, otherwise ``None``.
Returns a file descriptor for the filename if that file exists, otherwise ``None``.
Returns a file descriptor for the filename if that file exists otherwise ` ` None ` ` .
def open_if_exists(filename, mode='rb', encoding='utf-8'):
  if not os.path.isfile(filename) and (mode.rfind('r') != -1 or mode.rfind('a') != -1):
    return None
  try:
    import codecs
  except ImportError:
    try:
        return open(filename, mode=mode, encoding=encoding)
    except ValueError:
        return open(filename, mode=mode)
  else:
    return codecs.open(filename, mode)
def open_if_exists ( filename , mode = 'rb' , encoding = 'utf-8' ) : if not os . path . isfile ( filename ) and ( mode . rfind ( 'r' ) != - 1 or mode . rfind ( 'a' ) != - 1 ) : return None try : import codecs except ImportError : try : return open ( filename , mode = mode , encoding = encoding ) except ValueError : return open ( filename , mode = mode ) else : return codecs . open ( filename , mode )
Returns a file descriptor for the filename if that file exists, otherwise ``None``.
Returns a file descriptor for the filename if that file exists otherwise ` ` None ` ` .
"""Returns a file descriptor for the filename if that file exists, otherwise ``None``.""" #_io.BufferedReader
filename
mode
encoding