0
How to split a single word which does not contain any delimiter.? Eg "message" output - [m, e, s, s, a, g, e]]
How to split a single word which does not contain any delimiter.? Eg "message" output - [m, e, s, s, a, g, e]]
4 odpowiedzi
+ 3
here:
#using list comprehension
print([i for i in "message"])
+ 2
you can but only on version <=2.2.*
+ 1
How about slicing? Something like:
String[:2] + (whatever string) or
l.extend([string[:2],string[2:]])
Or you use partition, which will also take a delimiter, but won't erase it but keep it as part of a tuple for later use.
0
Can't I do this using the split functionality??