How can i parse a long string that come from a .txt file every
2 characters
?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can just zip two strings, with a gap of one offset
And a similar solution using itertools.izip
If you are using Py3.X, convert the map to LC
As @Duncan mentioned, the sub-strings would overlap. In case if you want non-overlapping substrings, either refer @Duncan’s answer, or @Duncan’s comment or the grouper recipe
You can easily join the resultant list to a string