Last modified: Jan 10, 2023 By Alexander Williams

Print each Character of a String in python (Simple Example)

probably you want to print each character of a string, so in this tutorial, we'll learn how you can do that with the best way

1. Print each character of string

Example 1:

 
#string
string = "my name is mark"

#loop
for i in string:
    #print each character
    print(i)

output

m                                                                                                                                     
y                                                                                                                                     

n                                                                                                                                     
a                                                                                                                                     
m                                                                                                                                     
e 

i
s 

m                                                                                                                                     
a                                                                                                                                     
r                                                                                                                                     
k    

As you can see, we have print each character of the string

now let's say that you want to add "+" between every character, there are many ways to do that, but in our case, we'll use join() built-in function

Example 2:adding "+" between each character

 
#string
string = "my name is mark"


join_string = "+".join(string)

print(join_string)

output

m+y+ +n+a+m+e+ +i+s+ +m+a+r+k