Insert a newline character every 64 characters using Python
Posted
by biffabacon
on Stack Overflow
See other posts from Stack Overflow
or by biffabacon
Published on 2010-04-17T07:54:39Z
Indexed on
2010/04/17
8:03 UTC
Read the original article
Hit count: 243
Using Python I need to insert a newline character into a string every 64 characters. In Perl it's easy:
s/(.{64})/$1\n/
How could this be done using regular expressions in Python? Is there a more pythonic way to do it?
© Stack Overflow or respective owner