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:
- The solution of typeerror: expected string or buffer
- Shell script error newline syntax error near unexpected token
- [Solved] PHP Error: ErrorException: preg_match(): Compilation failed: invalid range in character class at offset …
- Transcoding of system.web.httputility.urlencode in C #
- Python TypeError: not all arguments converted during string formatting
- [Solved] error: ‘gets’ was not declared in this scope; did you mean ‘fgets’?
- [Solved] Mybatis error: attempted to return null from a method with a primitive return type (int)
- [Solved] Python Error: UnicodeDecodeError: ‘gb2312’ codec can’t decode byte 0xa4 in position… : illegal multibyte sequence
- shell :syntax error: unexpected end of file
- [Solved] TypeError: string indices must be integers, not str