謝庭維python檔案方法utf8

 f = open("ascii.txt", "r+", encoding='utf8')

x = f.read()
print(x)
f.write("\n劉任昌") #寫入字串
f.close() #劉任昌關閉檔案r+讀增加append
print('f長度',len(x))
for i in x: #用迴圈印出每一個字元
    print(i)

留言

這個網誌中的熱門文章

謝庭維Javascript迴圈自訂函數

謝庭維金融市場常識Math公式