mirror of
https://github.com/python/cpython.git
synced 2025-09-14 20:56:06 +00:00
Patch #407434: add rfc822_escape utility function
This commit is contained in:
parent
bc32024769
commit
df66df0a28
1 changed files with 10 additions and 0 deletions
|
@ -443,3 +443,13 @@ byte_compile(files, optimize=%s, force=%s,
|
||||||
(file, cfile_base)
|
(file, cfile_base)
|
||||||
|
|
||||||
# byte_compile ()
|
# byte_compile ()
|
||||||
|
|
||||||
|
def rfc822_escape (header):
|
||||||
|
"""Return a version of the string escaped for inclusion in an
|
||||||
|
RFC-822 header, by adding a space after each newline.
|
||||||
|
"""
|
||||||
|
header = string.rstrip(header)
|
||||||
|
header = string.replace(header, '\n', '\n ')
|
||||||
|
return header
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue