乐谱xml歌词转化为拼音
using
代码语言:javascript
复制python3 xml2Pinyin.py xml_in_dir xmlpy_out_dir
代码语言:javascript
复制#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "errrolyan"
# Date: 18-10-16
# Describe = "乐谱xml文件转化为拼音”
import os,re,sys
import os.path
import xml.etree.ElementTree as ET
import pinyin
from collections import Counter
def coverFiles(sourceDir, targetDir):
for files in os.listdir(targetDir):
filepath = os.path.join(targetDir,files)
os.remove(filepath)
for file in os.listdir(sourceDir):
sourceFile = os.path.join(sourceDir, file)
targetFile = os.path.join(targetDir, file)
if os.path.isfile(sourceFile):
open(targetFile, "wb").write(open(sourceFile, "rb").read())
def fileread(filepath):
pathDir = os.listdir(filepath)
for s in pathDir:
newDir = os.path.joi