SoFunction
Updated on 2024-11-14

python string append example

Append characters one by one to the string with a for loop:

Method I:

string = ''
str=u"Additional characters"
for i in range(len(str)):
  string+=str[i]
print string

Show results:

Additional characters

Method II:

string = []
str=u"1234"
for i in range(len(str)):
  (str[i])
print string

Show results:

[u'1', u'2', u'3', u'4']

This python string append example above is all I have to share with you, I hope it will give you a reference, and I hope you will support me more.