My code:
The content is treated as a string
content[len(content)/2:len(content)/2+5]
Error:
TypeError: slice indices must be integers or None or have an __ index__ method
Looking through a lot of data, we find that Python may be converted to floating-point number when dividing. You need to change the “/” in it to “/ /” to run it
Similar Posts:
- How to Solve TypeError: not all arguments converted during string formatting
- [Solved] PythonTypeError: ‘<' not supported between instances of 'str' and 'int'
- How to Use Array.prototype.slice.call(arguments)
- TypeError: list indices must be integers or slices, not tuple
- Python bug problems and solutions sorted out in recent days
- [Solved] TypeError: string indices must be integers, not str
- Solve Python MySQL insert int data error: typeerror% d format: a number is required, not str
- TypeError: list indices must be integers or slices, not str
- How to Solve Error: TypeError int object is not iterable
- [Solved] net.sf.json.JSONException: java.lang.ClassCastException: JSON keys must be strings.