- 帖子
- 909
- 积分
- 1215
- 技术
- 3
- 捐助
- 0
- 注册时间
- 2018-1-17
|
3楼
发表于 2020-4-18 13:57
| 只看该作者
回复 2# wujunkai
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import time
dictLrc = {}
def lrcTime(lrc):
dictLrc = lrc
listLrc = sorted(dictLrc)
timeLen = len(listLrc)
timeFree = 0
count = 0
for i in listLrc:
timeFree = i -count
time.sleep(timeFree)
print(dictLrc)
count = i
def revertTime(time):
time1 = time
timeList = time1.split(":")
return round(float(timeList[0]) * 60 + float(timeList[1]),2)
def getLrc():
rf = open("lrc.txt","r")
getlrc = rf.read()
rf.close()
return getlrc
def splitStr(getstr):
global dictLrc
getStr = getstr
count = 0
for i in getStr:
if i =="[":
count +=1
getStr = getStr.replace("][","*")
getStr = getStr.replace("[","*")
getStr = getStr.replace("]","*")
lineLrc = getStr.split("*")
for i in range(1,count+1):
LrcTimes = revertTime(lineLrc)
dictLrc[LrcTimes] = lineLrc[-1]
def printLrc(lrc):
lrc1 = lrc
for i in lrc1:
splitStr(i)
lrc = getLrc()
listLrc = lrc.split('\n')
printLrc(listLrc)
lrcTime(dictLrc) |
|