Message97299
| Author |
flox |
| Recipients |
flox |
| Date |
2010年01月06日.08:46:44 |
| SpamBayes Score |
1.7219301e-05 |
| Marked as misclassified |
No |
| Message-id |
<1262767606.8.0.225636949209.issue7643@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Bytes objects and Unicode objects do not agree on ASCII linebreaks.
## Python 2
for s in '\x0a\x0d\x1c\x1d\x1e':
print u'a{}b'.format(s).splitlines(1), 'a{}b'.format(s).splitlines(1)
# [u'a\n', u'b'] ['a\n', 'b']
# [u'a\r', u'b'] ['a\r', 'b']
# [u'a\x1c', u'b'] ['a\x1cb']
# [u'a\x1d', u'b'] ['a\x1db']
# [u'a\x1e', u'b'] ['a\x1eb']
## Python 3
for s in '\x0a\x0d\x1c\x1d\x1e':
print('a{}b'.format(s).splitlines(1),
bytes('a{}b'.format(s), 'utf-8').splitlines(1))
['a\n', 'b'] [b'a\n', b'b']
['a\r', 'b'] [b'a\r', b'b']
['a\x1c', 'b'] [b'a\x1cb']
['a\x1d', 'b'] [b'a\x1db']
['a\x1e', 'b'] [b'a\x1eb'] |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年01月06日 08:46:46 | flox | set | recipients:
+ flox |
| 2010年01月06日 08:46:46 | flox | set | messageid: <1262767606.8.0.225636949209.issue7643@psf.upfronthosting.co.za> |
| 2010年01月06日 08:46:45 | flox | link | issue7643 messages |
| 2010年01月06日 08:46:44 | flox | create |
|