On 2/24/11, Christopher Brookes <chris.klai...@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. > > class Power: > def __init__(self, name, desc): > self.name = name > self.desc = desc > > > > > powerAll = [ > Power('Flammes infernales' , 'Embrase lenemi et le feu bruler'), > Power('Froid devorant', 'Gele lenemi sur place')] > > > But he won't display it :( How are you calling it? That is, what code are you using to try to display the contents of the list? Is powerAll supposed to be a variable in a class? If so, it should be self.powerAll. > > i've try For PowerName,PowerDesc in powerAll: > print (PowerName, PowerDesc) > > but it doesn't work ! What does that mean? It prints something strange, or you get an error? What error is it? Also, "for" should be lowercase, though I am honestly not sure that this is a requirement(though I believe it is). > > Thank you again.. > > -- > Brookes Christopher. >
-- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor