0

in jupyter notebook, I can do

%time print 'hello world'

and it will print out wall time etc.

But I cannot do the same in Visual studio 2019, I am using python 3.8, it complains syntax error

ipython is there

Any idea?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Jason
  • 81
  • 6
  • What do you mean "ipython is there"? Just because it is installed doesnt mean you can evaluate cell magic commands from a plain Python script. – OneCricketeer Jan 28 '21 at 21:37
  • First, `print 'hello world'` is invalid Python3 syntax. Second, see https://stackoverflow.com/questions/8220801/how-to-use-timeit-module – OneCricketeer Jan 28 '21 at 21:38
  • New in python, under my virtual environment, iPython is there. So how can someone print out the wall time in VS 2019? I know, it should be print('hello world') – Jason Jan 28 '21 at 21:39
  • Well, you can use [notebooks in VSCode](https://code.visualstudio.com/docs/python/jupyter-support), not sure of VS2019. Otherwise, what you are trying to do is just short-hand for the answer in linked post – OneCricketeer Jan 28 '21 at 21:41

0 Answers0