YouTip LogoYouTip

Python3 Os Write

# Write string str = "This is site" ret = os.write(fd, bytes(str, 'UTF-8')) # Print return value print ("The number of bytes written: ") print (ret) print ("Write successful") # Close file os.close(fd) print ("File closed successfully!!")

Executing the above program outputs the following result:

The number of bytes written: 
23
Write successful
File closed successfully!!

Python3 OS File/Directory Methods Python3 OS File/Directory Methods

← Python3 Os WritePython3 Os Utime β†’