我忘记了我的 Tiktok 帐户的 Gmail 电子邮件地址的最后 3 个字符。如何在Python中编写和检查由A-Z、a-z和0-9字母和数字组成的单个字母和数字?即如何在 python 中使用 A-Z、a-z 和 0-9 字母和数字找到它?
我还有另一个问题。当使用以
import imaplib
和import string
开头的Python代码时,是否应该安装imaplib
和string
以及如何安装?
itertools.product
:
import itertools
import string
EMAIL_LOCAL_NAME_PREFIX = 'your_email_local_name_prefix'
EMAIL_DOMAIN_NAME = 'gmail.com'
CHARS = string.ascii_letters + string.digits # (A-Z, a-z, 0-9)
for p in itertools.product(CHARS, repeat=3):
email_local_name_suffix = ''.join(p)
email = f'{EMAIL_LOCAL_NAME_PREFIX}{email_local_name_suffix}@{EMAIL_DOMAIN_NAME}'
print(email)
输出:
请注意,有 238328 个电子邮件地址可供检查...
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
...
[email protected]
[email protected]
[email protected]
your_email_local_nam[email protected]
[email protected]
至于你的第二个问题,
imaplib
和string
是标准库的一部分,所以你不需要使用像pip
之类的东西来安装它们。