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:
Conclusion
Thought this article, you complete Concatenate and Split Strings in Python. Thanks for reading! Thank you for reading the DevopsRoles page!