我无法使用python3文件中的读取功能读取字符

时间:2018-12-26 05:25:41

标签: python-3.x

#First i created a file named tt.txt using following code:
f=open("tt.txt","w+")

print(f)
f.write("Hello")
f.write("World")
f.close()

#and now i want to read 3rd character so i wrote the following code: 
f=open("tt.txt","r")
text=f.read()
print(text)
print(f.read(2))
#But it dosen't work 

我无法使用read()访问第三个元素,即“ l”。我不可以使用2作为参数

0 个答案:

没有答案