python - How to manipulate users input in a functions parameter -
i don't know if question made sense, i'll best explain. have many lists (rounds 1-20) , want ask user round on can jump right it. have function works each list, need know list use
round1 = [1, 2, 3, 4] round2 = [5, 6, 7, 8] class makeup(): def example_round(self,filler): self.filler = filler if 'a' in filler: return example_function(raw_input('what round on?'))
no user going type round1. they're gonna type either round 1 or 1. how can manipulate whatever input can pull desired round? want know if there way manipulate
example_function(raw_input('what round on?'))
so if put 1, can pull round1
use dict manage functions.
funcs = {"1": round1, "2": round2, ...} funcs[input]()
Comments
Post a Comment