hofer <[EMAIL PROTECTED]> wrote: > Let's take following perl code snippet: > > %myhash=( one => 1 , two => 2 , three => 3 ); > ($v1,$v2,$v3) = @myhash{qw(one two two)}; # <-- line of interest > print "$v1\n$v2\n$v2\n"; > > How do I translate the second line in a similiar compact way to > python?
One point I haven't seen in the other responses is that, at least for the example given, you don't need the second line at all: mydict={ 'one': 1, 'two': 2, 'three': 3 } print "%(one)s\n%(two)s\n%(two)s" % mydict -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list