Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52545
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'level,': 0.07; 'string': 0.09; 'newline': 0.09; 'parsed': 0.09; 'style.': 0.09; "wouldn't": 0.14; "'rb')": 0.16; 'encodings': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'quoted': 0.16; 'respected.': 0.16; 'simple.': 0.16; 'wrote:': 0.18; 'else,': 0.19; 'thu,': 0.19; 'import': 0.22; 'aug': 0.22; 'earlier': 0.24; '(or': 0.24; 'source': 0.25; '15,': 0.26; 'handling': 0.26; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'are.': 0.31; 'file': 0.32; 'something': 0.35; 'received:google.com': 0.35; 'disk': 0.36; 'to:addr:python-list': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'information': 0.63; 'actually,': 0.84; 'dealt': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=AVsAjbLQErkFW91fPjPLg1Sy2NxqBBqdsGk/1WLfkDs=; b=iYNwdIwRgttek5i/fgZfAd214TXGYGSGcUC/iYImommEIqlbHVOL1jQdRUNAJgxd2+ BI1udA8e1D+YjnSFFSW6jTH3kVaChGBcY403AjJouyDZKtaWTgNdaTuIMw7HMbY0EMbR 5RO2JmLibM3q5qPcE2QaOawvzBjvV8trr5mZ4+jKPY7tte0lyMVBgx3m5rI4aIm6SzS5 ziWl0+S87FaghMpvZMdRUXAg/1loYVB1BE4Kv/FA1cko5hBMyQFsezUDgOG1+bO8uJhS /sFeG1PIMbxabFcQcR0o/AxALXjL5u2wh4mdjAZ03kaVyCSrS8p018vGqx5m7mjmqIaU J2Bg== |
| MIME-Version | 1.0 |
| X-Received | by 10.66.102.41 with SMTP id fl9mr870045pab.169.1376560450752; Thu, 15 Aug 2013 02:54:10 -0700 (PDT) |
| In-Reply-To | <f36cbbf2-ae7a-4536-af81-0593b1f59b1d@googlegroups.com> |
| References | <94f8428f-50b9-4ccd-95a0-6eeafda0fe18@googlegroups.com> <mailman.560.1376457700.1251.python-list@python.org> <teHOt.12173$Oi7.5131@fx28.am4> <mailman.568.1376476309.1251.python-list@python.org> <XnsA21D681A5EF91duncanbooth@127.0.0.1> <f36cbbf2-ae7a-4536-af81-0593b1f59b1d@googlegroups.com> |
| Date | Thu, 15 Aug 2013 10:54:10 +0100 |
| Subject | Re: .split() Qeustion |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.592.1376560460.1251.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1376560460 news.xs4all.nl 15935 [2001:888:2000:d::a6]:43388 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52545 |
Show key headers only | View raw
On Thu, Aug 15, 2013 at 10:46 AM, <wxjmfauth@gmail.com> wrote:
> A technical ascpect of triple quoted strings is
> that the "end of lines" are not respected.
>
>>>> import zzz
>>>> zzz.__doc__
> 'abc\ndef\n'
>>>> with open('zzz.py', 'rb') as fo:
> ... r = fo.read()
> ...
>>>> r
> b'"""abc\r\ndef\r\n"""\r\n'
>
> Now, one can argue...
Actually, they are respected. Triple-quoted strings are parsed after
the file is read in, and newline handling is dealt with at an earlier
level, same as encodings are. You wouldn't expect that string to
retain information about the source file's encoding, and nor do you
expect it to retain the source file's newline style. A newline is
represented in the file on disk as \r\n or \n (or something else,
even), and in the string as \n. It's that simple.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
.split() Qeustion eschneider92@comcast.net - 2013-08-13 21:51 -0700
Re: .split() Qeustion Gary Herron <gary.herron@islandtraining.com> - 2013-08-13 22:12 -0700
Re: .split() Qeustion Alister <alister.ware@ntlworld.com> - 2013-08-14 08:30 +0000
Re: .split() Qeustion Joshua Landau <joshua@landau.ws> - 2013-08-14 11:31 +0100
Re: .split() Qeustion Alister <alister.ware@ntlworld.com> - 2013-08-14 13:29 +0000
Re: .split() Qeustion Duncan Booth <duncan.booth@invalid.invalid> - 2013-08-15 09:15 +0000
Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-15 02:46 -0700
Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-15 10:54 +0100
Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-15 11:22 +0000
Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-15 06:58 -0700
Re: .split() Qeustion Peter Otten <__peter__@web.de> - 2013-08-14 13:45 +0200
Re: .split() Qeustion Joshua Landau <joshua@landau.ws> - 2013-08-14 12:55 +0100
Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-14 07:32 -0700
Re: .split() Qeustion random832@fastmail.us - 2013-08-14 13:05 -0400
Re: .split() Qeustion Steven D'Aprano <steve@pearwood.info> - 2013-08-15 07:17 +0000
Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-14 18:14 +0100
Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-15 00:46 -0700
Re: .split() Qeustion Lele Gaifax <lele@metapensiero.it> - 2013-08-15 16:38 +0200
Re: .split() Qeustion MRAB <python@mrabarnett.plus.com> - 2013-08-15 15:54 +0100
Re: .split() Qeustion Lele Gaifax <lele@metapensiero.it> - 2013-08-15 17:30 +0200
Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-15 16:43 +0100
Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:13 +0000
Re: .split() Qeustion Roy Smith <roy@panix.com> - 2013-08-16 00:29 -0400
Re: .split() Qeustion Dave Angel <davea@davea.name> - 2013-08-16 05:27 +0000
Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-17 02:38 +0000
Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-17 03:45 +0100
Re: .split() Qeustion Gene Heskett <gheskett@wdtv.com> - 2013-08-16 10:30 -0400
Re: .split() Qeustion Gene Heskett <gheskett@wdtv.com> - 2013-08-16 10:24 -0400
Re: .split() Qeustion Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-08-17 11:16 +1200
Re: .split() Qeustion Ben Finney <ben+python@benfinney.id.au> - 2013-08-16 15:59 +1000
Re: .split() Qeustion Roy Smith <roy@panix.com> - 2013-08-16 07:14 -0400
Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-16 06:14 -0700
Re: .split() Qeustion Roy Smith <roy@panix.com> - 2013-08-16 09:23 -0400
Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-17 01:09 -0700
Re: .split() Qeustion Roy Smith <roy@panix.com> - 2013-08-17 07:55 -0400
Re: .split() Qeustion Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-08-18 11:30 +1200
Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-18 00:17 -0700
Re: .split() Qeustion Grant Edwards <invalid@invalid.invalid> - 2013-08-16 13:59 +0000
Re: .split() Qeustion Joshua Landau <joshua@landau.ws> - 2013-08-15 17:54 +0100
Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-15 19:28 +0100
Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:17 +0000
Re: .split() Qeustion Joshua Landau <joshua@landau.ws> - 2013-08-15 19:40 +0100
Re: .split() Qeustion Terry Reedy <tjreedy@udel.edu> - 2013-08-15 17:40 -0400
Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:22 +0000
Re: .split() Qeustion Dave Angel <davea@davea.name> - 2013-08-15 22:56 +0000
Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:39 +0000
Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:41 +0000
Re: .split() Qeustion Tim Chase <python.list@tim.thechases.com> - 2013-08-14 12:29 -0500
Re: .split() Qeustion Skip Montanaro <skip@pobox.com> - 2013-08-14 12:38 -0500
Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-14 18:46 +0100
Re: .split() Qeustion Terry Reedy <tjreedy@udel.edu> - 2013-08-14 15:45 -0400
Re: .split() Qeustion Dave Angel <davea@davea.name> - 2013-08-14 05:35 +0000
Re: .split() Qeustion eschneider92@comcast.net - 2013-08-13 22:44 -0700
Re: .split() Qeustion Krishnan Shankar <i.am.songoku@gmail.com> - 2013-08-13 22:37 -0700
.split() Qeustion "Alfonso Andalon Jr." <alfonsoandalon@gmail.com> - 2013-08-16 21:31 -0700
csiph-web