You are viewing an older version (9.12.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.12.0 / IPython / utils / openpy / read_py_file

function

IPython.utils.openpy:read_py_file

source: /IPython/utils/openpy.py :62

Signature

def   read_py_file ( filename : str | Path skip_encoding_cookie : bool = True )  →  str

Summary

Read a Python file, using the encoding declared inside the file.

Parameters

filename : str

The path to the file to read.

skip_encoding_cookie : bool

If True (the default), and the encoding declaration is found in the first two lines, that line will be excluded from the output.

Returns

: A unicode string containing the contents of the file.

Aliases

  • IPython.utils.openpy.read_py_file