python文件处理小方法
文件打开
1 contents = open("file_name.txt","rb").read().decode("gbk").encode("utf8")
1 def open_dict(Dict, path): 2 paths = os.path.join(path,Dict) 3 dictionary = open(paths,"rb").read().decode("utf8") 4 return(dictionary.split("\n"))
文件打开
1 contents = open("file_name.txt","rb").read().decode("gbk").encode("utf8")
1 def open_dict(Dict, path): 2 paths = os.path.join(path,Dict) 3 dictionary = open(paths,"rb").read().decode("utf8") 4 return(dictionary.split("\n"))