Is there no switch function in Python

Rudi Hansen rsh_remove_this_ at pobox.dk
Thu Sep 9 16:15:30 EDT 2004


I dont seem to be able to find the switch statement in Python.

I would like to be able to do

switch(var)
    case 1 :
        print "var = 1"
    case 2:
        print "var = 2"

But it seems that i have to do.

if(var=1)
    print "var =1"
elseif(var=2)
    print "var=2"

Is ther no easier way?? 





More information about the Python-list mailing list