A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/297573.html below:

using variable-value

using variable-value using variable-valueTor Erik Sønvisen tores at stud.cs.uit.no
Wed Sep 21 10:58:47 EDT 2005
Hi

In php I can assign a value to a variable and use this varaible to access a 
property in some object:

$var = 'property';
$object->{$var}

This will transelate to $object->property...
Is this possible in Python?

# Prints help on methods in Canvas-instance
for method in dir(self.canvas):
    print method
    print help(self.canvas.method)

gives me " AttributeError: Canvas instance has no attribute 'method' "...

regards tores 



More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4