1 回答

TA貢獻(xiàn)1830條經(jīng)驗(yàn) 獲得超9個(gè)贊
您真正想要做的是將列表中的每個(gè)元素添加到它自己的單元格中,如 A1、A2、A3 等。像這樣嘗試,看看它是否能給你你正在尋找的結(jié)果。
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')
添加回答
舉報(bào)