为什么变不了大写
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'
求各位大神看一看为什么出错?