I have a python file filled with 161 different classes. I am trying to pick one class randomly from the file to be used in the main section of my program. I initially started using Pythons random choosing a number between 1 and 161 then writing out a match pattern to select one corresponding to a number. After completing 4 of these I realised it was going to take hours and could not find an alternative online. Thank you for any help.
For reference, the file with all the classes is named "champions.py" and I only need to take the title for each class. E.g. for the following class I only want to take "aatrox"
class aatrox:
name = "Aatrox"
gender = "Male"
position = ["Top", "Middle"]
species = ["Darkin"]
resource = "Manaless"
rangeType = "Melee"
region = ["Noxus"]
releaseYear = 2019
Aucun commentaire:
Enregistrer un commentaire