python - How to print string in this way -


For each string, I need to print every 6 letters.

For example:

  example_string = "This is an example string okay ????" Myfunction (example_string) "This is I # an A # xample # strin # g. OK # ????"  

What is the most effective way to do this?

(0, lane (example_string), 6)] ([example_string [a: a + 6])

/ Pre>

It runs very fast, too. On my machine, five microsounds per 100-character string:

  & gt; & Gt; & Gt; Import time and gt; & Gt; & Gt; Join ([A: A + 6] for Timat Timer ("'#'. (0, Lane, 6)])," s = 'x' * 100 "() 4.9556539058685303  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -