I tried to ask this question once before, but nobody understood what I want to ask. So I've found example in PHP.
// $_POST = array('address' => '123', 'name' => 'John Doe');
extract($_POST);
echo $address;
echo $name
Is there's a function like extract()
in Python?
So the same goes to dictionary:
mydict = {'raw':'data', 'code': 500}
// some magic to extract raw and code as vars
print raw
P.S. Why I want to do this: When you're in class method, it's damned hard to have 6 manipulation with strings in join()
and format()
when string is self.data['raw']['code']
(assume it's a dict in a dict).