About 109,000 results
Open links in new tab
  1. Python random function - Stack Overflow

    Feb 21, 2013 · The 'random' module is a package from the python standard library, as well as a function defined in this package. Using 'import random' imports the package, which you can …

  2. python - How can I randomly select (choose) an item from a list …

    As of Python 3.6 you can use the secrets module, which is preferable to the random module for cryptography or security uses. To print a random element from a list:

  3. python - What is the difference between FROM random IMPORT

    Now, when you're accessing random, you're accessing the function instead of the module. You could use randrange (without the prefix random.), but import random and explicitly stating what …

  4. Como gerar números aleatórios em Python?

    Jul 24, 2015 · Para gerar números aleatórios em Python 3, você pode usar a biblioteca " random ". Aqui está um exemplo para gerar um número inteiro aleatório entre 0 e 9:

  5. Generate a random letter in Python - Stack Overflow

    Is there a way to generate random letters in Python (like random.randint but for letters)? The range functionality of random.randint would be nice but having a generator that just outputs a …

  6. Random word generator- Python - Stack Overflow

    Using random.sample will provide you with a list of the total number of items (characters in this case) from the given object (a string object here) based on the number you want …

  7. macos - Cant import random python - Stack Overflow

    Jul 26, 2017 · The traceback is relatively clear: you attempt to import randint from random; inside the python random module it attempts to import names from math; unfortunately, you chose to …

  8. How to generate random strings in Python? - Stack Overflow

    Mar 17, 2022 · How do you create a random string in Python? I need it to be number then character, repeating until the iteration is done. This is what I created: def random_id(length): …

  9. Difference between "import random" and "import sys, random" in …

    May 23, 2022 · 0 import sys, random is importing 2 different modules: sys and random. However, import random will only import the random module. If the script in your book is importing the …

  10. Generate password in Python - Stack Overflow

    Oct 4, 2010 · I'd like to generate some alphanumeric passwords in Python. Some possible ways are: import string from random import sample, choice chars = string.ascii_letters + string.digits …