#-*-coding:UTF-8-*-
import io
print(u"文件存放路径需加上英文双引号,例如:“E:/1.txt”")
print(u"请输入1.txt文件存放路径:")
pathfile=input()
print(u"程序已开始运行")
f=io.open(str(pathfile),"r",encoding='utf-8')
data=f.readline()
print(data)
f.close()
f_new=io.open(str(pathfile),"w",encoding='utf-8')
array = data.split('&')
f_new.write('{\n')
linenum = 0
for line in array:
linenum+=1
array1 = line.split('=')
array1[0] = "\"" + array1[0] + "\""
array1[1] = "\"" + array1[1] + "\""
line = ':'.join(array1) + ',\n'
if (linenum == len(array)):
line = ':'.join(array1) + '\n'
f_new.write(line)
f_new.write('}\n')
f_new.close()
print("程序执行完成!")