Python
Python基础
python环境搭建
python-列表
python基本语法
变量
变量与对象
数据类型
类型检查
类型转换
运算符
python虚拟环境
格式化字符串
python元组
pandas学习
easygui使用
textfsm使用
python循环
转换编码格式
os模块下常用的函数和方法使用
文件存储
网络运维自动化
python基础
python列表
python函数一
python字符串
python字典
python数据类型
正则表达式学习
python的 Nornir简介与使用
netaddr简介与使用
Python爬虫
Python网络编程
本文档使用 MrDoc 发布
-
+
首页
转换编码格式
```python # 打开带BOM的UTF-8文本,编码格式为utf-8-sig,将内容读取到content with open("sw.log","r",encoding="utf-8-sig") as old_file: content = old_file.read() # 重新打开一个文件,使用w模式覆盖内容写入,指定编码格式为utf-8,写入内容为上面读取的内容 with open("sw.log","w",encoding="utf-8") as new_file: new_file.write(content) ```
Chuck
2023年6月29日 15:24
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码