当前位置:网站首页>3. File operation 3-with
3. File operation 3-with
2022-07-06 08:17:00 【wwanxinghao】
1、with: Benefits: no need to close files manually (f.close())
The following is a simple operation of reading files
with open(' New files .txt',mode='r' ,encoding='utf-8') as f:
for i in f:
print(i.strip())
2、 The following validation with No use close()
3、 Pattern mode='rb', Yes Read non text , Namely , Audio , video , Picture these , These are not stored in strings , It is stored in bytes ;mode='wb', Write audio , video , Picture these data ( They are stored in bytes )
The following example is , Will a mp4 The operation of assigning a copy to a file
边栏推荐
- Machine learning - decision tree
- PHP - Common magic method (nanny level teaching)
- 将 NFT 设置为 ENS 个人资料头像的分步指南
- Parameter self-tuning of relay feedback PID controller
- Use dumping to back up tidb cluster data to S3 compatible storage
- Online yaml to CSV tool
- Tidb backup and recovery introduction
- Pyqt5 development tips - obtain Manhattan distance between coordinates
- TiDB备份与恢复简介
- "Designer universe": "benefit dimension" APEC public welfare + 2022 the latest slogan and the new platform will be launched soon | Asia Pacific Financial Media
猜你喜欢
C语言自定义类型:结构体
"Designer universe" Guangdong responds to the opinions of the national development and Reform Commission. Primary school students incarnate as small community designers | national economic and Informa
化不掉的钟薛高,逃不出网红产品的生命周期
Sanzi chess (C language)
[nonlinear control theory]9_ A series of lectures on nonlinear control theory
"Friendship and righteousness" of the center for national economy and information technology: China's friendship wine - the "unparalleled loyalty and righteousness" of the solidarity group released th
[research materials] 2021 Research Report on China's smart medical industry - Download attached
[Yugong series] February 2022 U3D full stack class 011 unity section 1 mind map
Convolution, pooling, activation function, initialization, normalization, regularization, learning rate - Summary of deep learning foundation
C language custom type: struct
随机推荐
Online yaml to CSV tool
[Yugong series] February 2022 U3D full stack class 010 prefabricated parts
07- [istio] istio destinationrule (purpose rule)
Onie supports pice hard disk
MFC sends left click, double click, and right click messages to list controls
Use br to back up tidb cluster data to S3 compatible storage
Leetcode question brushing record | 203_ Remove linked list elements
Data governance: Data Governance under microservice architecture
数据治理:误区梳理篇
从 TiDB 集群迁移数据至另一 TiDB 集群
flask返回文件下载
MFC 给列表控件发送左键单击、双击、以及右键单击消息
The resources of underground pipe holes are tight, and the air blowing micro cable is not fragrant?
Wireshark grabs packets to understand its word TCP segment
Erc20 token agreement
Golang DNS write casually
使用 BR 备份 TiDB 集群数据到兼容 S3 的存储
Database basic commands
Asia Pacific Financial Media | designer universe | Guangdong responds to the opinions of the national development and Reform Commission. Primary school students incarnate as small community designers
Binary tree creation & traversal