1 回答
TA贡献1830条经验 获得超9个赞
您真正想要做的是将列表中的每个元素添加到它自己的单元格中,如 A1、A2、A3 等。像这样尝试,看看它是否能给你你正在寻找的结果。
import openpyxl
wb = openpyxl.Workbook ()
sheet = wb.active
addresses = [
'132 W Raven Dr, Chandler, AZ 85286',
'2412 W Binner Dr, Chandler, AZ 85224',
'1081 W Lark Dr, Chandler, AZ 85286',
'1603 W Maplewood St, Chandler, AZ 85286',
'1300 W Estrella Dr, Chandler, AZ 85224',
'2120 E Geronimo St, Chandler, AZ 85225',
'2100 W Shannon St, Chandler, AZ 85224',
'4591 S Felix Pl, Chandler, AZ 85248',
'2290 E Cherrywood Pl, Chandler, AZ 85249',
'23421 S 130th St, Chandler, AZ 85249',
'1601 E Shannon St, Chandler, AZ 85225']
for index in range (len (addresses)) :
cell = 'A' + str (index + 1)
sheet [cell] = addresses [index]
wb.save ('tester.xlsx')
添加回答
举报