1. The string module contains various string constant which contains the ASCII characters of all cases. It has separate constants for lowercase, uppercase letters, digits, and special symbols, which we use as a source to generate a random string. Pass string constants as a source of randomness to the random module to create a random string 2. The string.ascii_lowercase returns a list of all the lowercase letters from 'a' to 'z'. This data will be used as a source to generate random characters. 3. Decide how many characters you want in the resultant string.
確定! 回上一頁