# 域名生成:import string''' 1.可以生成hg000.com 2.重在数字的添加 '''def f1(): input_wd = input('请输入要生成网站的关键字:') for i in range(1111, 10000): print('00' + str(i) + input_wd + '.com') print(input_wd + str(i) + '.com') print(str(i) + input_wd + '.com')''' 1. 该方法可生成类似hga.com/hgb.com的域名 2.从a到z 字母的添加'''def f2(): input_wd = input('请输入要生成网站的关键字:') for word in string.ascii_lowercase: domain_list = input_wd + word + '.com' + '\n' for domain in domain_list: print(domain, end='')def f3(): input_wd = input('请输入要生成网站的关键字:') for i in range(1, 10000): if i < 10: domain = input_wd + '0' + str(i) + '.com' elif i <= 100: domain = input_wd + str(i) + '.com' elif 200 <= i <= 999: domain = input_wd + '0' + str(i) + '.com' else: domain = input_wd + str(i) + '.com' print(domain)def f4(): input_wd = input('请输入要生成网站的关键字:') for i in range(1, 10000): if i < 10: domain = input_wd + str(i) + '.com' elif i <= 100: domain = input_wd + str(i) + '.com' elif 200 <= i <= 999: domain = input_wd + '0' + str(i) + '.com' else: domain = input_wd + str(i) + '.com' domain = input_wd + str(i) + '.com' domain = input_wd + str(i) + '.net' print(domain)def f5(): input_wd = input('请输入要生成网站的关键字:') for word in string.ascii_lowercase: # domain_list = input_wd + word*2 + '.com' + '\n' domain_list = input_wd + word + '.com' + '\n' # domain_list = word + input_wd + '.com' + '\n' for domain in domain_list: print(domain, end='')if __name__ == '__main__': f4()
来源:https://www.cnblogs.com/victorstudy/p/11425873.html