问题一; for s in sting: print(s) 问题二: import itertools import csv list2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] x = list(itertools.product(list2, repeat=3)) sting = [''.join(map(str, tpl)) for tpl in x] for s in sting: print(s) csv_headers = ['排列数组', '期号', '开奖号码', '预测号码', '开奖日期', '和值', '百位号码走势', '十位号码走势', '各位号码走势', '组选号码分布', '和尾', '组选', '奇偶比', '大小比', '012路个数比'] with open('PermutationThree.csv', 'w', encoding='gbk', newline='') as f: f_csv = csv.writer(f) f_csv.writerow(csv_headers) # 给每个字符串创建一个新行 for s in sting: f_csv.writerow([s] + [''] * (len(csv_headers) - 1))