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,”
  • After splitting and Concatenate new strings: DevOpsRolescom

The small program written by python as below:

# Strings = "Dev,Ops,R,o,"
# My blog: 
string = "Dev,Ops,R,o,"
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


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 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 *

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