Answers for "how to make charactert list python"

5

how to print a char of element in list in pyhton

#declaring list
myList=[12,'Hello','World!']
#for strings
print(myList[1][2]) # output --> l
#for numbers
temp=str(myList[0])
print(temp[1]) # output --> 2
Posted by: Guest on September-15-2020
4

python string to list of chars

l = list('abcd')  	        # ['a', 'b', 'c', 'd']
l = map(None, 'abcd')       # ['a', 'b', 'c', 'd']
l = [i for i in 'abcd']	    # ['a', 'b', 'c', 'd']

import re               # importing regular expression module
l = re.findall('.', 'abcd')
print(l)                	# ['a', 'b', 'c', 'd']
Posted by: Guest on May-13-2021

Code answers related to "how to make charactert list python"

Python Answers by Framework

Browse Popular Code Answers by Language