How to Concatenate and Split Strings in Python

In this tutorial, I’m splitting and Concatenate a strings in Python.

How to Concatenate and Split Strings in Python:

  • Initial Strings “Dev,Ops,R,o,l.e.s.com”
  • After splitting and Concatenate new strings: DevOpsRolescom

The small program written by python as below:

# Strings = "Dev,Ops,R,o,l.e.s.com"
# My blog: www.devopsroles.com 
string = "Dev,Ops,R,o,l.e.s.com"
print("Initial Strings: {}".format(string))
cleanstring = ''
for i in range(0,len(string)):
        if string[i] in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ':
                   cleanstring = cleanstring + string[i]
newcleanstring = str(cleanstring)
print("New Strings: {}".format(newcleanstring))

The result as picture below:

How to Concatenate and Split Strings in Python

Conclusion

Thought this article, you complete Concatenate and Split Strings in Python. Thanks for reading! Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

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