[[io.StringIO]]を使う。 ```python import io with io.StringIO("string in file") as f: print(f.readline()) ```