Append character to string Python | Example code

Use + operator or join method to append a character into string Python.

Example append a character to string Python

Simple example code appends string to another string in Python. The Python string is an immutable object, so any methods that perform some action on a string return a new string.

Using + Operator

It concatenates two strings or a string and a character and returns a new string in Python.

s = "Hell"
c = "o"

print(s + c)


Append character to string Python

Using the join() Method

The string.join() method concatenates all the iterable object elements using the string as a separator between the elements.

s = "Hell"
c = "o"
res = "".join((s, c))


Output: Hello

Do comment if you have any doubts and suggestions no this Python append char topic.

Note: IDE: PyCharm 2021.1.3 (Community Edition)

Windows 10

Python 3.7

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.