1. Problem description
Running the python file today encountered the following error:
ModuleNotFoundError: No module named 'cStringIO'
Two, the solution
The reason is that python3.X has canceled the cStringIO module, but StringIO can be found in the io module. So the solution is:
the main reason is that the module has been removed from python3.X cStringIO
, we can only find the module in the io module StringIO
, so the code needs to be modified:
import cStringIO as sio
change into
from io import StringIO as sio
reference link
[1] Long Heart Like Water. ImportError: No module named 'cStringIO' [EB/OL]. https://blog.csdn.net/S20144144/article/details/100518249, 2019-09-03/2023-03- twenty one.