..I also want to ask you, folder can also use data = open('.. \.. \.. \Album\test',mode='w') open and write? Don't you have to write in a file? Like a file in the test folder?
..In the following code, the created folder test is always read-only, can not be changed manually, and instantly changed to read-only
def imp():
import easygui as g
#print(levelchoose.get(),modechoose.get(),songschoose.get())
if songschoose.get() == '0':
g.msgbox(msg='你没有选择任何歌曲!',title='错误')
else:
pathA = '.\\' + songschoose.get()
pathB = '..\\..\\..\\Album\\test\\' + songschoose.get()
#print(pathA)
if not os.path.isdir('..\\..\\..\\Album\\test'):
os.mkdir('..\\..\\..\\Album\\test')
os.chmod('..\\..\\..\\Album\\test',stat.S_IWRITE)
shutil.copyfile(src=pathA,dst=pathB)
Delaytxt = open('.\\Delay.txt',mode='r',encoding='utf-8')
#print(Delaytxt.readlines())
delay = ''
lines = Delaytxt.readlines()
print(lines)
for i in lines:
temp2 = i.split(',')
temp3 = list(songschoose.get())
temp3[-1] = ''
temp3[-2] = ''
temp3[-3] = ''
temp3[-4] = ''
temp4 = ''.join(temp3)
print(temp2)
if temp2[0] == temp4:
delay = temp2[1]
if delay == '':
g.msgbox(msg='错误!未在Delay.txt中找到延迟信息\n请检查Delay.txt\n可能是因为你手动修改了Delay.txt,那么将这个文件删除,在制谱器中从新保存即可。',title='错误')
else:
os.chmod('..\\..\\..\\Album\\test',stat.S_IWRITE)
data = open('..\\..\\..\\Album\\test',mode='w')
data.write('\n'+songschoose.get()+'#'+modechoose.get()+'#'+levelchoose.get()+'#'+delay)
g.msgbox(msg='导入成功',title='消息')
How to solve
0 Answer
这家伙很懒,什么都没留下...