Input problem

Piet van Oostrum piet at
Tue Jun 16 17:39:03 EDT 2009

>>>>> Lie Ryan <lie.1296 at> (LR) wrote:

>LR> Piet van Oostrum wrote:
>>>>>>>> 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())  # or z = input() in py-2
>LR> import subprocess; subprocess.Popen(['killuser', 'now', '-j20', '-O3'])
>LR> eocaioewurf4fcrejcomefvweracv
>>>>> _

SyntaxError: invalid syntax eval will not accept statements like import,
only expressions. But as Scott David Daniels already had mentioned you
can shoot yourself in the foot easily with input() or eval() if you
can't trust the input.
Piet van Oostrum <piet at>
URL: [PGP 8DAE142BE17999C4]
Private email: piet at

More information about the Python-list mailing list