Getting into Python, comming from Perl.

Mage mage at mage.hu
Sun Apr 24 14:10:26 EDT 2005


Miguel Manso wrote:

>
>
> I've tryed to use python some times but I get frustrated very quick. I
> get myself many times needing to figure out how to loop through a
> list, declare an associative array, checking how to pass named
> parameters to functions, and simple things like that.

list = [3,5,9,11]
list.append(17)
for i in list:
    print i

foo = dict()
foo['bar'] = 7
foo['trooll'] = 'green'

for k,v in foo.iteritems():
    print k, v

def test(**args):
    for key in args.keys():
        print key, args[key]

test(a='apple', c='orange')

       Mage




More information about the Python-list mailing list