Ignore IPython magic in python
问题 What is the best way to ignore IPython magic when running scripts using the python interpreter? I often include IPython magic in my script files because it work with the code interactively. For example, with the autoreload magic, I don't have to keep reload -ing the modules after I make some changes and fix bugs: %load_ext autoreload %autoreload 2 However, when I try to run this script using a usual python interpreter, I get an error: File "<string>", line 1 %load_ext autoreload ^ SyntaxError