I've made and example code here just to show what I want to get done:
import random
class myclass:
def __init__(self,example):
self.example=example
listexample = ["1","2","3","4","5"]
objlist = []
for i in listexample:
objlist.append(myclass(i))
#Ok so here I got a list of objects
def examplefunction(listex, myproblem):
randomnumber = random.randrange(0,5)
print(listex[randomnumber].example) # This works, of course
print(listex[randomnumber].myproblem) # here, myproblem should be "example" and print one of my numbers.
examplefunction(objlist,"example") # here.. I want this to get the attribute of the class
I just need to know if it is doable and approximately how? Don't know if I'm trying to do something that just isn't right but if this could be done it would be a good solution for me. Maybe try to guide me to the right piece of text which can explain?