Добрый день! Набирал в интерактивной оболочке команду:
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) on win32
Type “copyright”, “credits” or “license()” for more information.
>>> import openpyxl
>>> import os
>>> os.chdir(r“C:\Users\Anton\Desktop\Python”)
>>> wb = openpyxl.load_workbook('produceSales.xlsx')
>>> wb = openpyxl.load_workbook('produceSales.xlsx')
>>> sheet = wb.get_sheet_by_name('Sheet')
>>> PRICE_UPDATES = {'Kale': 234,'Grapes': 235,'Apples':236 }
>>> for rowNum in range(2, sheet.get_highest_row()):
produceName = sheet.cell(row=rowNum, column=1).value
if produceName in PRICE_UPDATES:
sheet.cell(row=rowNum, column=2).value = PRICE_UPDATES
wb.save('updatedProduceSales.xlsx')
Выдало сообщение:
Traceback (most recent call last):
File “<pyshell#14>”, line 1, in <module>
for rowNum in range(2, sheet.get_highest_row()):
AttributeError: ‘Worksheet’ object has no attribute ‘get_highest_row’
Потом заменил:
get_highest_row()) на sheet.max_row()):
Выдало новую
Traceback (most recent call last):
File “<pyshell#21>”, line 1, in <module>
for rowNum in range(2, sheet.max_row()):
TypeError: ‘int’ object is not callable
>>>
но программу не выполнило.
Подскажите, пожалуйста, где моя ошибка?