Skip to content

Instantly share code, notes, and snippets.

@vndee
Created June 21, 2024 16:53
Show Gist options
  • Save vndee/57aaa38f78be2e22c8f6734130eedfbb to your computer and use it in GitHub Desktop.
Save vndee/57aaa38f78be2e22c8f6734130eedfbb to your computer and use it in GitHub Desktop.
import time
# Simulate an I/O-bound task
def read_file():
time.sleep(2) # Simulating waiting for I/O operation (e.g., reading a file)
return "File content"
# Calling the I/O-bound task
start_time = time.time()
content = read_file()
end_time = time.time()
print(f"Read file in {end_time - start_time} seconds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment