[Solved] How can I split a string in Python? [duplicate]

[ad_1]

This is actually a great application for a python list comprehension one-liner!

my_str="123456781234567812345678"
splits=[my_str[x:x+8] for x in range(0,len(my_str),8)]
//splits = ["12345678","12345678","12345678"]

Let me know if you have any questions.

3

[ad_2]

solved How can I split a string in Python? [duplicate]