Introduction
In this blog, we will discuss how to treat a string like a list, in Python.The output will display in the Run module.
Software Requirement
Python 3.5.2
Simple Programming
- print("Welcome To C#Corner..........")
- print("Treating String Like A List :")
-
- names=["C#Corner","MVP","Author","Member Of Month"]
- print("%s" % names[0])
- print("%s" % names[0][0],"%s" % names[1][0])
- print("%s" % names[2],"%s" % names[3])
Explanation
In the above code, we are giving the string. And, using the print() function, we can get the strings as list, as shown below. The output can be seen in the Run Module.
Output