020_with

Posted liujun5319

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了020_with相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env python
# Author:liujun

with open("test","r",encoding="utf-8") as f:
for line in f:
print(line.strip())


with open("test","r",encoding="utf-8") as f,open("test.bak","w",encoding="utf-8") as f_new:
for line in f:
f_new.write(line.upper())










以上是关于020_with的主要内容,如果未能解决你的问题,请参考以下文章

020_with

Python_020(几个经典内置方法)

Lesson 020 —— python 条件控制

020_Java版本及模块

leeson_020 分支语句 笔记

020_面向对象