import re with open('redbull.txt', 'r', encoding='utf-8') as f: data = f.read() title_list = re.findall('<h2>(.*?)</h2>', data) address_list = re.findall("<p class='mapIco'>(.*?)</p>", data) email_list = re.findall("<p class='mailIco'>(.*?)</p>", data) phone_list = re.findall("<p class='telIco'>(.*?)</p>", data) all_list = list(zip(title_list, address_list, email_list, phone_list)) for item in all_list: print(""" 公司:%s 地址:%s 邮箱:%s 电话:%s """ % (item[0], item[1], item[2], item[3]))