How to read/print the ( _io.TextIOWrapper) data?

The file is already closed (when the previous with block finishes), so you cannot do anything more to the file. To reopen the file, create another with statement and use the read attribute to read the file.

with open('test_output.txt', 'r') as f2:
    data = f2.read()
    print(data)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)