[Tutor] Display all field of a listuples
Steven D'Aprano
steve at pearwood.info
Thu Feb 24 23:46:50 CET 2011
Alex Hall wrote:
> On 2/24/11, Christopher Brookes <chris.klaitos at gmail.com> wrote:
>> Hi i would like to display all the field of my powerAll like this :
>>
>> Choose a power :
>> Froid devorant : Embrase lenemi et le feu bruler
>> Flammes infernales : 'Gele lenemi sur place
>>
>> -----------------------------
>> class Character():
>> def ChoosePouvoirUnique(self):
>> print ("Choose a power")
>> for Power in powerAll:
>> print (Power)
> You need a __init__() function in this class, as with any class.
That's not strictly correct. You don't *need* an __init__ method, unless
your class needs to be initialised. Most classes will, but some do not.
[...]
> Also, "for" should be lowercase, though I am
> honestly not sure that this is a requirement(though I believe it is).
It certainly is. Python is case sensitive, so "for" and "FOR" and "For"
are different. "for" is a Python keyword with special meaning. The
others are just words with no special meaning.
--
Steven
More information about the Tutor
mailing list