- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I concatenate str and int objects in Python?
To concatenate a string with numbers, you need to cast the numbers to string using str(number). For example,
>>> a = "string" >>> b = 1 >>> print a + str(b) string1
In Python 2, you can also use backtick(``) to surround the number and get the same result with numbers and strings. Note that backticks have been removed from Python 3. For example,
>>> a = "string" >>> b = 1 >>> print a + `b` string1
- Python: Can not understand why I am getting the error: Can not concatenate 'int' and 'str' object
- Python: Cannot understand why the error - cannot concatenate 'str' and 'int' object ?
- How can I concatenate two arrays in java
- How to concatenate a std::string and an int in C++?
- How can I update child objects in MongoDB?
- How can I make my custom objects Parcelable?
- How can I make my custom objects Serializable?
- How can I update child objects in MongoDB database?
- str() vs repr() in Python?
- Concatenate string to an int value in Java
- How we can convert Python objects into JSON objects?
- How can I filter JSON data with multiple objects?
- How can I concatenate an array of integer in MongoDB aggregation method?