View Single Post
  #1 (permalink)  
Old 03-23-2008, 09:12 PM
Deep fried ice-cream Deep fried ice-cream is offline
Newbie
 
Join Date: Feb 2008
Location: Wellington, NZ
Posts: 3
Rep Power: 0
Deep fried ice-cream is on a distinguished road
Send a message via Skype™ to Deep fried ice-cream
Question Naming objects in python

How do I make my python script create objects automatically? (e.g. After the contents of a variable).

I don’t actually have a source code as my project needs one of these to get started but I put in a simple example in case I’m not being very clear.
Any help would be appreciated.

Code:
class test:
    def __init__(self,x):
        self.x = x

for i in range (1,11):
    name = chr(96 + i)
    name = test(i)
Reply With Quote

Sponsored Links