当前位置:网站首页>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
边栏推荐
- Step by step guide to setting NFT as an ens profile Avatar
- Leetcode question brushing record | 203_ Remove linked list elements
- Hcip day 16
- 1. Color inversion, logarithmic transformation, gamma transformation source code - miniopencv from zero
- 使用 TiDB Lightning 恢复 S3 兼容存储上的备份数据
- Sanzi chess (C language)
- 2.10transfrom attribute
- [Yugong series] February 2022 U3D full stack class 010 prefabricated parts
- Onie supports pice hard disk
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
猜你喜欢
C language - bit segment
Nacos Development Manual
Understanding of law of large numbers and central limit theorem
[redis] Introduction to NoSQL database and redis
It's hard to find a job when the industry is in recession
指针进阶---指针数组,数组指针
07- [istio] istio destinationrule (purpose rule)
Leetcode question brushing record | 203_ Remove linked list elements
Sanzi chess (C language)
Esrally domestic installation and use pit avoidance Guide - the latest in the whole network
随机推荐
Yu Xia looks at win system kernel -- message mechanism
Notes on software development
数据治理:元数据管理篇
Résumé des diagrammes de description des broches de la série ESP
C语言自定义类型:结构体
23. Update data
What are the ways to download network pictures with PHP
Erc20 token agreement
NFT smart contract release, blind box, public offering technology practice -- contract
1. Color inversion, logarithmic transformation, gamma transformation source code - miniopencv from zero
[Yugong series] February 2022 U3D full stack class 011 unity section 1 mind map
Common functions for PHP to process strings
matplotlib. Widgets are easy to use
Webrtc series-h.264 estimated bit rate calculation
On why we should program for all
【MySQL】数据库的存储过程与存储函数通关教程(完整版)
All the ArrayList knowledge you want to know is here
08- [istio] istio gateway, virtual service and the relationship between them
Binary tree creation & traversal
MFC 给列表控件发送左键单击、双击、以及右键单击消息