How to get last opend file content

Hi, I‘m new here, I to get current file content, but how can I get previous one. :heart:

I try, but it gives some string, not object.

I want to create a plugin to read “.py” file and highlight.
so I want to open it ,and auto add a marker ```python ```` to file start.
and when I switch file ,delete last one’s marker