skrf.util.get_fid

skrf.util.get_fid(file, *args, **kwargs)[source]

Return a file object, given a filename or file object.

Useful when you want to allow the arguments of a function to be either files or filenames

Parameters:
  • file (str/unicode or file-object) – file to open

  • *args (arguments and keyword arguments to open())

  • **kwargs (arguments and keyword arguments to open())

Returns:

fid

Return type:

file object