Nov-14-2023, 08:46 AM
I concur that dictionary or list is the way to go.
One way to create dictionary from sentence can be dictionary comprehension:
One way to create dictionary from sentence can be dictionary comprehension:
>>> sentence = "All work and no play makes Jack a dull boy." >>> {f"var_{i}": v for i, v in enumerate(sentence.split())} {'var_0': 'All', 'var_1': 'work', 'var_2': 'and', 'var_3': 'no', 'var_4': 'play', 'var_5': 'makes', 'var_6': 'Jack', 'var_7': 'a', 'var_8': 'dull', 'var_9': 'boy.'} >>>
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.