mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-09-05 11:56:23 +00:00
修正库导入BUG
This commit is contained in:
@ -1,31 +1,3 @@
|
||||
def get():
|
||||
from openpyxl import *
|
||||
|
||||
wb = load_workbook('program音色表.xlsx')
|
||||
|
||||
ws = wb.active
|
||||
# 所有行
|
||||
keys = []
|
||||
values = []
|
||||
for row in ws.iter_rows():
|
||||
for cell in row:
|
||||
# print(cell.value)
|
||||
try:
|
||||
keys.append(int(cell.value))
|
||||
except ValueError:
|
||||
values.append(cell.value)
|
||||
# # 所有列
|
||||
# for column in ws.iter_cols():
|
||||
# for cell in column:
|
||||
# print(cell.value)
|
||||
out = ""
|
||||
index = 0
|
||||
for i in keys:
|
||||
out += ", \"" + str(i) + "\": \"" + values[index] + "\""
|
||||
index += 1
|
||||
|
||||
print(out)
|
||||
|
||||
|
||||
idList = {"0": "harp", "1": "harp", "2": "pling", "3": "harp", "4": "pling", "5": "pling", "6": "harp", "7": "harp",
|
||||
"8": "share", "9": "harp", "10": "didgeridoo", "11": "harp", "12": "xylophone", "13": "chime", "14": "harp",
|
||||
|
28
msctPkgver/readXLSX.py
Normal file
28
msctPkgver/readXLSX.py
Normal file
@ -0,0 +1,28 @@
|
||||
from openpyxl import *
|
||||
|
||||
|
||||
def get():
|
||||
wb = load_workbook('program音色表.xlsx')
|
||||
|
||||
ws = wb.active
|
||||
# 所有行
|
||||
keys = []
|
||||
values = []
|
||||
for row in ws.iter_rows():
|
||||
for cell in row:
|
||||
# print(cell.value)
|
||||
try:
|
||||
keys.append(int(cell.value))
|
||||
except ValueError:
|
||||
values.append(cell.value)
|
||||
# # 所有列
|
||||
# for column in ws.iter_cols():
|
||||
# for cell in column:
|
||||
# print(cell.value)
|
||||
out = ""
|
||||
index = 0
|
||||
for i in keys:
|
||||
out += ", \"" + str(i) + "\": \"" + values[index] + "\""
|
||||
index += 1
|
||||
|
||||
print(out)
|
Reference in New Issue
Block a user