wdsfdfds 2021-06-08 08:32 采纳率: 28.6%
浏览 19
已采纳

初学python 这个代码之前运行没问题,现在运行完什么都不输出了,怎么回事呀

import datetime
import time
from openpyxl import load_workbook
from win32com.client import Dispatch

wb = load_workbook("D:\周继彪\法国兰斐\报表数据统计\每日报表\\2021法国兰斐综合报表(勿动).xlsx",data_only=True)
sheets = wb.worksheets  # 获取当前所有的sheet
print(sheets)

now = datetime.datetime.now()
now1 = time.strftime('%Y-%m-%d',time.localtime(time.time()))
print(time.strftime('%Y-%m-%d',time.localtime(time.time())))
print(now1)

start_time = datetime.datetime.strptime('2021-06-01', '%Y-%m-%d')
print(start_time)
end_time = datetime.datetime.strptime('2021-07-01', '%Y-%m-%d')
print(end_time)

# 获取当前工作表
if start_time < now < end_time:
    d = now.day
    print(d)
    m = now.month
    print(m)
    n = m*2-2
    k = m*2-1
    sheet1 = sheets[n]
    sheet2 = sheets[k]
    print(sheet1)
    print(sheet2)
    cell1 = sheet1.cell((d + 1)*12+1,4).value
    print(cell1)
    cell2 = sheet1.cell((d + 2)*12+1,3).value
    cell3 = sheet1.cell((d + 2) * 12 + 1, 16).value
    cell4 = sheet1.cell((d + 2) * 12 + 1, 17).value
    cell5 = sheet1.cell((d + 1) * 12 + 4, 16).value
    cell6 = sheet1.cell((d + 1) * 12 + 4, 17).value
    cell7 = sheet1.cell((d + 1) * 12 + 10, 16).value
    cell8 = sheet1.cell((d + 1) * 12 + 10, 17).value
    cell9 = sheet1.cell((d + 1) * 12 + 11, 16).value
    cell10 = sheet1.cell((d + 1) * 12 + 11, 17).value
    cell11 = sheet1.cell((d + 1) * 12 + 7, 16).value
    cell12 = sheet1.cell((d + 1) * 12 + 7, 17).value
    cell13 = sheet1.cell((d + 1) * 12 + 8, 16).value
    cell14 = sheet1.cell((d + 1) * 12 + 8, 17).value
    cell15 = sheet1.cell((d + 2) * 12, 16).value
    cell16 = sheet1.cell((d + 2) * 12, 17).value
    cell17 = sheet2.cell((d + 2) * 11 + 1, 3).value
    cell18 = sheet2.cell((d + 2) * 11 + 1, 4).value
    cell19 = sheet1.cell((d + 1) * 12 + 1, 20).value
    cell20 = sheet1.cell((d + 1) * 12 + 1, 18).value
    cell21 = sheet1.cell((d + 2) * 12 + 1, 7).value
    cell22 = sheet2.cell((d + 2) * 11 + 1, 13).value
    cell23 = sheet1.cell((d + 2) * 12 + 1, 19).value
    cell24 = sheet1.cell(25,5).value
    cell25 = sheet1.cell(25,16).value
    cell26 = sheet1.cell(25,17).value
    cell27 = sheet2.cell(23,3).value
    cell28 = sheet2.cell(23,4).value
    cell29 = sheet1.cell(25,20).value
    cell30 = sheet1.cell(25,21).value
    cell31 = sheet1.cell(25,22).value
    cell32 = sheet1.cell(25,7).value
    cell33 = sheet2.cell(23,13).value



def main():
    print(now1,'工作总结:')
    print('1.昨日花费:',cell1)
    print('2.今日账户总余额:',cell2)
    print('3.今日投放毛客资:',cell3)
    print('4.今日投放有效客资:',cell4)
    print('5.今日微信毛客资:',cell5)
    print('6.今日微信有效客资:', cell6)
    print('7.今日美团毛客资:', cell7)
    print('8.今日美团有效客资:', cell8)
    print('9.今日美团优美毛客资:', cell9)
    print('10.今日美团优美有效客资:', cell10)
    print('11.今日抖音自营毛客资:', cell11)
    print('12.今日抖音自营有效客资:', cell12)
    print('13.今日抖音蓝V毛客资:', cell13)
    print('14.今日抖音蓝V有效客资:', cell14)
    print('15.今日哪拍毛客资:', cell15)
    print('16.今日哪拍有效客资:', cell16)
    print('17.今日免费渠道毛客资:', cell17)
    print('18.今日免费渠道有效客资:', cell18)
    print('19.昨日毛客资均价:', cell19)
    print('20.昨日订单成本:', cell20)
    print('21.今日投放渠道订单量:', cell21)
    print('22.今日免费渠道订单量', cell22)
    print('23.昨日投入产出比:', cell23)
    print('24.月累计花费:', cell24)
    print('25.月累计投放毛客资:', cell25)
    print('26.月累计投放有效客资:', cell26)
    print('27.月累计免费毛客资:', cell27)
    print('28.月累计免费有效客资:', cell28)
    print('29.月累计毛客资均价:', "%.2f" % cell29)
    print('30.月累计有效毛客资均价:',"%.2f" % cell30)
    print('31.月累计有效客资均价:',"%.2f" % cell31)
    print('32.月累计投放渠道订单:', cell32)
    print('33.月累计免费渠道订单:', cell33)
    print('34.日工作总结:')
    print(    'a、整理客资系统,')
    print(    'b、整理数据,')
    print(    'c、优化抖音蓝V、自营广告')
    print(    'd、发布小红书笔记')
    print(    'e、美团客资整理')
    print(    'f、查看小红书投放')



if __name__ == '__main__':
    main()

 

  • 写回答

2条回答 默认 最新

  • Lonelypatients° 2021-06-08 08:37
    关注

    我的猜测是你执行文件错误, 执行的根本不是你写demo 的文件

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 MATLAB怎么通过柱坐标变换画开口是圆形的旋转抛物面?
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿