Python textwrap.wrap causing issue with \n
问题 So I just reformatted a bunch of code to incorporate textwrap.wrap, only to discover all of my \n are gone. Here's an example. from textwrap import wrap def wrapAndPrint (msg, width=25): """ wrap msg to width, then print """ message = wrap(msg, width) for line in message: print line msg = ("Ok, this is a test. Let's write to a \nnewline\nand then " "continue on with this message") If I print msg, I get the following >>> print msg Ok, this is a test. Let's write to a newline and then continue