码迷,mamicode.com
首页 > 其他好文 > 详细

020_with

时间:2018-09-05 21:53:12      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:strip()   utf-8   lin   style   env   upper   pytho   write   for   

#!/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

标签:strip()   utf-8   lin   style   env   upper   pytho   write   for   

原文地址:https://www.cnblogs.com/liujun5319/p/9594199.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!