当前位置:网站首页>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

边栏推荐
- [research materials] 2021 Research Report on China's smart medical industry - Download attached
- 指针和数组笔试题解析
- [nonlinear control theory]9_ A series of lectures on nonlinear control theory
- [research materials] 2021 live broadcast annual data report of e-commerce - Download attached
- Upgrade tidb operator
- Secure captcha (unsafe verification code) of DVWA range
- 22. Empty the table
- Learn Arduino with examples
- Vocabulary notes for postgraduate entrance examination (3)
- Notes on software development
猜你喜欢

Golang DNS write casually

24. Query table data (basic)

Understanding of law of large numbers and central limit theorem

面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读

数据治理:主数据的3特征、4超越和3二八原则

Summary of phased use of sonic one-stop open source distributed cluster cloud real machine test platform

Yyds dry goods inventory three JS source code interpretation eventdispatcher

在 uniapp 中使用阿里图标

C语言 - 位段

National economic information center "APEC industry +": economic data released at the night of the Spring Festival | observation of stable strategy industry fund
随机推荐
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
使用 Dumpling 备份 TiDB 集群数据到兼容 S3 的存储
Analysis of Top1 accuracy and top5 accuracy examples
Résumé des diagrammes de description des broches de la série ESP
Permutation and combination function
Mobile Test Engineer occupation yyds dry goods inventory
[redis] Introduction to NoSQL database and redis
Image fusion -- challenges, opportunities and Countermeasures
How to use information mechanism to realize process mutual exclusion, process synchronization and precursor relationship
Use dumping to back up tidb cluster data to S3 compatible storage
Golang DNS 随便写写
Convolution, pooling, activation function, initialization, normalization, regularization, learning rate - Summary of deep learning foundation
Hill sort c language
Secure captcha (unsafe verification code) of DVWA range
Webrtc series-h.264 estimated bit rate calculation
从 SQL 文件迁移数据到 TiDB
Asia Pacific Financial Media | female pattern ladyvision: forced the hotel to upgrade security. The drunk woman died in the guest room, and the hotel was sentenced not to pay compensation | APEC secur
好用的TCP-UDP_debug工具下载和使用
从 CSV 文件迁移数据到 TiDB