Created
June 21, 2024 16:53
-
-
Save vndee/57aaa38f78be2e22c8f6734130eedfbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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