diff --git a/.gitignore b/.gitignore index d48cb25..a945659 100644 --- a/.gitignore +++ b/.gitignore @@ -140,3 +140,6 @@ dmypy.json # Cython debug symbols cython_debug/ + +# Pycharm +/.idea diff --git a/README.md b/README.md index a4f220d..0029806 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ > > `pip install brotli` > +> `pip install openpyxl` +> > 3. 开始使用! > 在目录下打开cmd,进入到目录下,执行以下命令:(选择你需要的) > diff --git a/README_EN.md b/README_EN.md index 2c7ccfe..3617f60 100644 --- a/README_EN.md +++ b/README_EN.md @@ -66,6 +66,8 @@ A simple Python package. > > `pip install brotli` > +> `pip install openpyxl` +> > 3. Start using! > > Open CMD in the directory, enter the directory, and execute the following commands: diff --git a/msctPkgver/load_InstrumentLabel.py b/msctPkgver/load_InstrumentLabel.py index ce51767..d847d44 100644 --- a/msctPkgver/load_InstrumentLabel.py +++ b/msctPkgver/load_InstrumentLabel.py @@ -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", diff --git a/msctPkgver/readXLSX.py b/msctPkgver/readXLSX.py new file mode 100644 index 0000000..c5bb33f --- /dev/null +++ b/msctPkgver/readXLSX.py @@ -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)