我是python和stackoverflow的初学者。我已经导入了openpyxl和tkinter来做到这一点:
def cell_range():
global combinedCells
try:
startRange = startingCell.get()
endRange = endingCell.get()
for rowOfCellObjects in chosenSheet[startRange:endRange]:
for cellObj in rowOfCellObjects:
stringValues = str(cellObj.value)
combinedCells = []
combinedCells.append('-'.join(stringValues for r1 in rowOfCellObjects))
listbox4.insert(END, combinedCells)
except IndexError:
pass
我想做这样的事情:How to combine one row's data into a single cell using Openpyxl
为什么我的列表框中显示Addie Ramirez-Addie Ramirez,而不是1-Addie Ramirez?我有两列,数字和名称。第一列似乎被忽略了。
我确实提到了这一点:https://automatetheboringstuff.com/chapter12/
谢谢!