[Python] How can I make the get_random_string Django module to return only numerical values?

Discussão em 'Python' iniciado por Stack, Maio 30, 2025.

  1. Stack

    Stack Membro Participativo

    What should I do to my simple code below, so that it only returns numerical values?

    >>> from django.utils.crypto import get_random_string
    >>> get_random_string(10)
    >>> 'PhaWT9X02U'


    Something like: 1067603657 And if it is possible, can you recommend an id field generated in this manner?

    Continue reading...

Compartilhe esta Página