摘要:        
一、写入空文件(覆盖) # coding=UTF-8 filename = 'test_text.txt' with open(filename, 'w') as file_object: file_object.write("Add a word") 如果写入文件不存在,open()将自动创建它     阅读全文
posted @ 2020-09-15 21:08
巴黎爱工作
阅读(521)
评论(0)
推荐(0)
        
            
        
        
摘要:        
发现用json.dumps时发现保存到文件中时中文部分变成unicode字符,如图 解决方法: 1.将data格式化成字符串 2.在json.dumps中加ensure_ascii,设置ensure_ascii=False 原因:1. Python 3已经将unicode作为默认编码2. Pytho    阅读全文
posted @ 2020-09-15 20:55
巴黎爱工作
阅读(2796)
评论(0)
推荐(0)
        
 
                    
                     
                    
                 
                    
                
 
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号