[Python] how can I make a dictionary using regex? [closed]

Discussão em 'Python' iniciado por Stack, Janeiro 15, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new to python and I have some regex pattern for making a key set of dictionary. ex) [a-z] : abc...xyz (the actual pattern is more complex) and i want a dictionary with some values. let's say it is just range(1, 27) so the result i want is {"a": 1, "b": 2, ..., "y":25, "z":26}

    If I can make a list such as ["a", "b", .., "y", "z"] using regex [a-z] i can make it but i don't know how to make a list from regex patterns...

    Continue reading...

Compartilhe esta Página