What is an alternative to execfile in Python 3?

python, python-3.x

Solution

According to the documentation, instead of

execfile("./filename") 

Use

exec(open("./filename").read())

See:

- What’s New In Python 3.0

- `execfile`

- `exec`

Problem

It seems they canceled in Python 3 all the easy ways to quickly load a script by removing `execfile()`. Is there an obvious alternative I'm missing?

Original source

Related problems