import openpyxl
import os
# 1. 找出点赞数在100000次以上的视频ID、标题和赞数
wb = openpyxl.load_workbook('某视频网站运营数据原始版.xlsx')
sheet=wb.active
max_r=sheet.max_row
max_c=sheet.max_column
for r inrange(2,max_r+1):if sheet.cell(r,6).value>100000:print('视频ID:',sheet.cell(r,1).value,'标题:',sheet.cell(r,2).value,'点赞数:',sheet.cell(r,6).value)
import openpyxl
import os
wb = openpyxl.load_workbook('某视频网站运营数据.xlsx')
sheet=wb.active
max_r=sheet.max_row
max_c=sheet.max_column
list=[]for r inrange(2,max_r+1):list.append(sheet.cell(r,1).value)for index inrange(len(list)-1,-1,-1):#从后往前删除重复的ID 然后连重复ID对应数据的单元 if list[index] in list[0:index]: #格内容都变成空串dellist[index]for c inrange(1,9):
sheet.cell(index+2,c).value=''
wb.save('某视频网站运营数据.xlsx')