Input problem
Piet van Oostrum
piet at cs.uu.nl
Tue Jun 16 15:47:42 EDT 2009
>>>>> Prasoon <prasoonthegreat at gmail.com> (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())
3+4
>>> z
7
>>> z=int(raw_input())
3+4
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 cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
More information about the Python-list
mailing list