return _compile(pattern, flags).search(string) TypeError: expected string or bytes-like object

Today, when using regular to process excel data, an error was reported. Record the processing method.

I checked the error at the beginning, but most of the answers from others did not solve my problem.

The meaning of the error is: type error: expected string or byte object

That is, I have a problem with the regular data. I checked my data type, and it turns out that several of them are not string types. 

 

But the number in my excel, the output in python is 8.0, 6.0 automatically fills me with a zero

Checked the setting method of excel: set the data as text, and the default regular input number is a number type

Modification method:

 

The appearance of a small triangle indicates that the modification is successful

 Then py can run normally.

Guess you like

Origin blog.csdn.net/tang242424/article/details/107678018