Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Contents of the Python output file

Shulou Source: shulou.com Published: 2022-06-03 06:11:11 09月24日 Update

Import os

Document = open ("testfile.txt", "w +")

Print ("File name:", document.name)

[xss_clean] ("this is the first test file I created!\ nwelcome!") #\ n indicates line feeds

Print (document.tell ()) # estimates how many bytes are read

Document.seek (os.SEEK_SET) # cannot read the contents of the file without this sentence

Context = document.read ()

Print (context)

Document.close ()

Tags: File content byte file name this is test output Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux macOS MySQL NVidia MariaDB