main
HuangHai 4 months ago
parent 79897cd68a
commit bb175e99c8

Binary file not shown.

Binary file not shown.

@ -0,0 +1,14 @@
{
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"currentFileConfiguration": true,
"console": "internalConsole",
"justMyCode": true,
"addSourceRootsToPythonpath": true,
},
]
}

@ -0,0 +1,3 @@
{
"python.django.project.enabled": false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

@ -3,6 +3,7 @@ import sys
import json
import os
import random
# pip3 install moviepy
from moviepy.editor import VideoFileClip
import threading

@ -1,52 +0,0 @@
from openpyxl import load_workbook
def column_letter_to_number(column_letter):
"""
Excel 列字母转换为数字
:param column_letter: 列字母 "A", "B", "Z", "AA", "AB"
:return: 列数字 例如 "A" 返回 1, "B" 返回 2
"""
result = 0
for i, letter in enumerate(reversed(column_letter)):
result += (ord(letter) - ord('A') + 1) * (26 ** i)
return result
# 输入文件路径
xlsx_file = r'D:\dsWork\2025年收集的人口与教育数据库20250328\2015-2020年的数据\基础教育\2019.xlsx'
sheet_name = '基教小学'
# 从第 8 行开始是有效数据
row_start = 8
# 定义列索引(列索引从 1 开始)
col_school_name = 2 # B 列:学校名称
col_school_type = 4 # D 列:办学类型
col_school_count = 6 # F 列:学校数量
# 加载 Excel 文件
wb = load_workbook(xlsx_file)
ws = wb[sheet_name]
col_city = column_letter_to_number('MM4') # MM4 列:市
col_district = column_letter_to_number('MN4') # MN4 列:区
# 遍历有效数据行并输出指定列的值
# for row in ws.iter_rows(min_row=row_start, values_only=True):
# school_name = row[col_school_name - 1] # B 列:学校名称
# school_type = row[col_school_type - 1] # D 列:办学类型
# school_count = row[col_school_count - 1] # F 列:学校数量
# city = row[col_city - 1] # MM 列:市
# district = row[col_district - 1] # MN 列:区
#
# if school_count > 0:
# # 打印指定列的值
# print(f"学校名称: {school_name}, 办学类型: {school_type}, 学校数量: {school_count}, 市: {city}, 区: {district}")
# 关闭 Excel 文件
ws.close()
wb.close()
Loading…
Cancel
Save