
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Python: Can not understand why I am getting the error: Can not concatenate 'int' and 'str' object
This error is coming because the interpreter is replacing the %d with i and then trying to add 1 to a str, ie, adding a str and an int. In order to correct this, just surround the i+1 in parentheses.
example
print("\ Num %d" % (i+1))
- Related Articles
- Python: Cannot understand why the error - cannot concatenate 'str' and 'int' object ?
- How can I concatenate str and int objects in Python?
- Why am I not getting the desired results despite working very hard?
- How can you avoid getting an error if you are deleting a table which does not exist using Python?
- Despite being rich, why am I not able to get happiness?
- Why humans can not digest Cellulose?
- While using SAP .NET connector, I am an getting error: Could not load file or assembly 'sapnco' or one of its dependencies.
- Getting error not assigned on running SAP ABAP program
- Getting this error: "Element is not clickable at point"
- Why can our elbow not move backwards?
- Getting error message: Scalar type not allowed in SAP HANA
- We can zoom camera, but why not the eyes?
- Why liquids can flow but are not compressible?
- I am having problem to understand the concept of positive and negative terminal
- How can I create a python directory if it does not exist?

Advertisements