注册 登录
编程论坛 Python论坛

为什么变不了大写

zsy142857 发布于 2017-06-10 17:16, 2269 次点击
f=open('sample1.txt')
j=open('sample2.txt','w')
i=f.upper()
k=write(i)
f.close()

Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
 RESTART: C:\Users\a.py
Traceback (most recent call last):
  File "C:\Users\a.py", line 3, in <module>
    i=f.upper()
AttributeError: '_io.TextIOWrapper' object has no attribute 'upper'

求各位大神看一看为什么出错?
1 回复
#2
zsy1428572017-07-04 19:38
不用回复了,我已知道
1