当前位置:网站首页>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
边栏推荐
- Learn Arduino with examples
- JS select all and tab bar switching, simple comments
- Tidb backup and recovery introduction
- 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
- Permutation and combination function
- The resources of underground pipe holes are tight, and the air blowing micro cable is not fragrant?
- Data governance: Data Governance under microservice architecture
- Leetcode question brushing record | 203_ Remove linked list elements
- C语言自定义类型:结构体
- Sanzi chess (C language)
猜你喜欢
Mex related learning
ESP series pin description diagram summary
【MySQL】数据库的存储过程与存储函数通关教程(完整版)
[cloud native] teach you how to build ferry open source work order system
Summary of phased use of sonic one-stop open source distributed cluster cloud real machine test platform
Easy to use tcp-udp_ Debug tool download and use
Convolution, pooling, activation function, initialization, normalization, regularization, learning rate - Summary of deep learning foundation
The State Economic Information Center "APEC industry +" Western Silicon Valley will invest 2trillion yuan in Chengdu Chongqing economic circle, which will surpass the observation of Shanghai | stable
National economic information center "APEC industry +": economic data released at the night of the Spring Festival | observation of stable strategy industry fund
C语言 - 位段
随机推荐
What is the use of entering the critical point? How to realize STM32 single chip microcomputer?
升级 TiDB Operator
[untitled]
Notes on software development
synchronized 解决共享带来的问题
24. Query table data (basic)
灰度升级 TiDB Operator
Résumé des diagrammes de description des broches de la série ESP
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读
华为云OBS文件上传下载工具类
Data governance: Data Governance under microservice architecture
vulnhub hackme: 1
22. Empty the table
[redis] Introduction to NoSQL database and redis
"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
Migrate data from SQL files to tidb
CAD ARX gets the current viewport settings
Common functions for PHP to process strings
A Closer Look at How Fine-tuning Changes BERT
Asia Pacific Financial Media | art cube of "designer universe": Guangzhou community designers achieve "great improvement" in urban quality | observation of stable strategy industry fund