会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132452个问题
Python 全系列/第一阶段:Python入门/面向对象 12197楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/容器 12198楼
JAVA 全系列/第一阶段:JAVA 快速入门/JAVA入门和背景知识 12199楼

import xlrd
from xlutils.copy import copy

def read_data():
    wb=xlrd.open_workbook('./base_data/data01.xlsx')
    sh=wb.sheet_by_index(0)
    fen_type={}
    count_price=[]

    for r in range(sh.nrows):
        count=sh.cell_value(r,3)
        count_price.append(count)
        key=sh.cell_value(r,0)
        if fen_type.get(key):
            fen_type[key]+=count
        else:
            fen_type[key]=count
    return fen_type,count_price

def save(fen,count):
    wb=xlrd.open_workbook('./base_data/data01.xlsx')
    sh_t=wb.sheet_by_index(0)
    wb2=copy(wb)
    sh=wb2.get_sheet(0)
    for r in range(sh_t.nrows):
        sh.write(r,sh_t.ncols,count[r])
    
    sh2=wb2,add_sheet('汇总数据')
    for i,key in enumerate(fen.keys()):
        sh2.write(i,0,key)
        sh2.write(i,1,fen.get(key))
    wb2.save('05_汇总数据.xlsx')

if __name__=="__main__":
    f,c=read_data()
    save(f,c)

PS D:\菁菁小私库\VScode> & "C:/Program Files (x86)/Python38-32/python.exe" d:/菁菁小私库/VScode/office办公自动化/05_统计数据.py

Traceback (most recent call last):

  File "d:/菁菁小私库/VScode/office办公自动化/05_统计数据.py", line 35, in <module>

    f,c=read_data()

  File "d:/菁菁小私库/VScode/office办公自动化/05_统计数据.py", line 5, in read_data

    wb=xlrd.open_workbook('./base_data/data01.xlsx')

  File "C:\Users\旸kn\AppData\Roaming\Python\Python38\site-packages\xlrd\__init__.py", line 170, in open_workbook

    raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')

xlrd.biffh.XLRDError: Excel xlsx file; not supported

PS D:\菁菁小私库\VScode> 


Python 全系列/ 第十四阶段:自动化操作办公软件、邮件、定时任务等/自动化操作办公软件、邮件、定时任务等 12200楼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>post请求</title>
</head>
<body>
  <label for="username">
      <span>用户名:</span>
      <input type="text" id="username" class="username">
  </label> <br>
  <label for="password">
      <span>密码:</span>
      <input type="text" id="password" class="password">
  </label> <br>
  <button>登录</button>
<script>
      var usernameInput=document.querySelector('.username');
      var passwordInput=document.querySelector('.password');
      var btn=document.querySelector('button');
      btn.onclick=function () {
          var xhr=new XMLHttpRequest();
          xhr.onreadystatechange=function () {
              if(xhr.readyState==4){
                  if (xhr.status==200){
                    // console.log(xhr.responseText);
                    console.log(JSON.parse(xhr.responseText));
                  }
              }
          };
          xhr.open('post','3-post请求.php',true);
         //构建post表单数据,使用FormData类构建数据
          var datas=new FormData();
          datas.append('uname',usernameInput.value);
          datas.append('upass',passwordInput.value);
          xhr.send(datas);
      }
</script>
</body>
</html>
<php
 $success=array("msg"=>"ok","info"=>$_POST);
 echo json_encode($success);
?>

老师我这个里面报错了,我不知道是哪的问题

blob.png

WEB前端全系列/第六阶段:Http服务与Ajax模块(旧)/Http服务与Ajax编程 12201楼

旅行.7z


老师,这个

springboot怎么启动不了是为啥照着视频也还是不行



JAVA 全系列/第十阶段:百战旅游网项目/百战旅游网 12202楼
JAVA 全系列/第一阶段:JAVA 快速入门/IDEA的使用和第一个java项目 12203楼
Python 全系列/第二阶段:Python 深入与提高/模块 12206楼
Python 全系列/第五阶段:数据库编程/mysql的使用 12207楼
JAVA 全系列/第八阶段:SpringBoot与MybatisPlus/Spring Boot旧 12208楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/智能电话本项目实战 12209楼
Python 全系列/第二阶段:Python 深入与提高/文件处理 12210楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637