Runtime Data Attributes
code.co_filename
Source filename recorded at compilation. It can be a synthetic label, not an actual filesystem location.
Formal Syntax & Structure
python syntaxpython
code.co_filenameReturn Value
str
Value exposed by this attribute; availability and mutability depend on the owner as described.
Working Example
Example Snippetpython
code = compile('x = 1','<demo>','exec')print(code.co_filename)