What does Python's eval() do?

前端 未结 10 2100
后悔当初
后悔当初 2020-11-22 01:48

In the book that I am reading on Python, it keeps using the code eval(input(\'blah\'))

I read the documentation, and I understand it, but I still do no

10条回答
  •  故里飘歌
    2020-11-22 02:35

    Maybe a misleading example of reading a line and interpreting it.

    Try eval(input()) and type "1+1" - this should print 2. Eval evaluates expressions.

提交回复
热议问题