The solution of typeerror: expected string or buffer

Error type: TypeError: expected string or buffer

Specific error explanation: This is because the returned variable is not a character type, which causes this error

The specific solution: add an if statement before the specific program segment to determine whether the program returns in a legal format, and if it is, continue to run the program.


[+] Because the return result of readlines is a sequence, but the 8th line should accept characters. So it leads to an error. You should use a for loop to make it into a character and then use regular matching.

 

Similar Posts: