AttributeError: ‘_io.TextIOWrapper‘ object has no attribute ‘softspace‘

Write the title of the table of contents here

1. Problem presentation 2. Solutions

1. Problem presentation

Problem display:

when I was learning the file module, I encountered such a situation. How can I solve this situation?

2. Solutions

This involves a version problem. As we all know, Python is mainly divided into Python 2 and python 3. When we check the python official website, we can see that
(Python website address: www.python. ORG)

it can be seen that in versions above 3.0, the softspace attribute may have been removed, so use the command line py – 2 (if you do not install python2, you need to install python2 first, python2 and python3 can be installed at the same time, and use py – 2 and py – 3 to switch under Windows Environment) to switch to python2.7, Open a file to view the softspace property, and the command line executes normally.

Read More: