

Some types) and isn't present at all in implementations that don't use This optimization is fragile even in CPython (it only works for In-place string concatenation for statements in the form a += b or a =Ī + b. Using the previous trick, it becomes : def get_one_random_name(letters):Įmail_name = email_name + random.choice(letters)Īlso, here is a recommandation from PEP 8 :įor example, do not rely on CPython's efficient implementation of Now, your get_one_random_name could be easily improved. Your letters list can easily be defined with a list comprehension and some manipulation of ord and chr : > Īs suggested in the comments, you can also use string.ascii_lowercase In your case, def get_one_random_domain(domains):īecomes : def get_one_random_domain(domains):Īnd maybe removes the need for a function in the first place. How can I choose letters randomly and put them together without +?įrom this Stack Overflow question : import random In get_one_random_name(), how can I make this email_name string grow with random letters without using "+ "? One_domain = str(get_one_random_domain(domains)) One_name = str(get_one_random_name(letters)) Return domainsĮmail_name = email_name + letters What is a more elegant way to generate 100 emails names using some Python libs/APIs? import randomĭomains = Is there another random integer library? Could I use something like ed() in C++?
RANDOM EMAIL GENERATOR YAHOO CODE
The code below generates only 10 email domains.
