for example, if the string is "Nikki",
then how can I split it into "N", "i", "k", "k", "i"
help pls
for example, if the string is "Nikki",
then how can I split it into "N", "i", "k", "k", "i"
help pls
You can just construct a list
using the string
>>> list('Nikki')
['N', 'i', 'k', 'k', 'i']
Although for what it's worth, a list of chr
is functionally equivalent to just iterating directly through the str
itself. In other words
for letter in 'Nikki':
will work, as will anything relying on a sequence type.