0
以下几个函数有更新了
DeprecationWarning: Call to deprecated function get_sheet_names (Use wb.sheetnames).
DeprecationWarning: Call to deprecated function get_sheet_by_name (Use wb).
DeprecationWarning: Call to deprecated function remove_sheet (Use wb.remove(worksheet) or del wb).
1
1
6666
1
...
答案回复可见
嘿嘿
答案
看看
import openpyxl as oxl
wb = oxl.load_workbook("豆瓣top250电影.xlsx")
sheet_names = wb.sheetnames
ws = wb]
nws = wb.copy_worksheet(ws)
for each_row in nws.rows:
if each_row.value == '阿甘正传':
each_row.value = '9.8'
if each_row.value == '这个杀手不太冷':
each_row.value = '9.6'
if each_row.value == '肖申克的救赎':
each_row.value = '9.7'
wb.save("豆瓣top250电影.xlsx")
import openpyxl
wb = openpyxl.load_workbook("豆瓣TOP250电影.xlsx")
ws = wb.get_sheet_by_name("Sheet")
for goal, value in [("阿甘正传", 9.8), ("这个杀手不太冷", 9.6), ("肖申克的救赎", 9.7)]:
name = ws['A1']
while name.value != goal:
name = name.offset(1, 0)
score = name.offset(0, 1)
score.value = value
wb.save("豆瓣TOP250电影(改).xlsx")
123456
新手报到。
朕想知道
学习学习
做完了
好好学习,就是贵了点