王恩琪python檔案方法utf8

f = open("ascii.txt", "r",encoding='utf8')
print(f.read())
f.close()
x = "王恩琪"
f = open("ascii.txt", "r+",encoding='utf8')
y = f.write(x)
print(y)
f.close()
    print(i)
f = open("ascii.txt", "r+",encoding='utf8') #a代表附加append
print("名稱",f.name)
print("模式",f.mode)
print("關閉",f.closed)
f.write('王恩琪')
line = f.read() #讀取檔案f成為字串
print('檔案字串長度',len(line))
print("檔案內容",line)
f.close()

影片379

影片380

Comments

Popular posts from this blog

王恩琪Python自訂函數迴圈write模式a,x,w,r

王恩琪W3SCHOOLS, EMOJI, ASCII CODE

王恩琪金融市場158至170數學符號輸入-math