Input problem

Piet van Oostrum piet at
Tue Jun 16 15:47:42 EDT 2009

>>>>> Prasoon <prasoonthegreat at> (P) wrote:

>P> What is the difference between
>P> z=int(raw_input()) and z=eval(raw_input())????(I thought them to be
>P> the same in case of integers)

>P> I mean when an integer is entered in that case are they same and when
>P> an integer in not entered,in that case how are they different?????

>>> z=eval(raw_input())
>>> z
>>> z=int(raw_input())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '3+4'

Piet van Oostrum <piet at>
URL: [PGP 8DAE142BE17999C4]
Private email: piet at

More information about the Python-list mailing list