I'm stupid
This commit is contained in:
17
tools/stdout_wrapper.py
Normal file
17
tools/stdout_wrapper.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
|
||||
|
||||
class StdoutWrapper:
|
||||
def write(self, message: str):
|
||||
print(message, end="")
|
||||
|
||||
def flush(self):
|
||||
pass
|
||||
|
||||
|
||||
def get_stdout():
|
||||
# Colab 環境をチェックする
|
||||
if "google.colab" in sys.modules:
|
||||
return StdoutWrapper()
|
||||
else:
|
||||
return sys.stdout
|
||||
Reference in New Issue
Block a user