'Python: why for loop is in the middle of join() function?
I don't understand the following code in the return statement. How come a for loop is inside a built-in function, join(), and not at the beginning in the middle of statement?
How is this working?
def randomString(stringLength=10):
"""Generate a random string of fixed length """
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
