Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #89911
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.099 |
| X-Spam-Evidence | '*H*': 0.82; '*S*': 0.01; 'raises': 0.09; 'subject:set': 0.09; 'exception?': 0.16; 'f.tell()': 0.16; 'subject:when': 0.16; 'tried:': 0.16; 'followed': 0.16; 'wrote:': 0.18; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'assert': 0.31; 'pipe': 0.31; 'file': 0.32; 'maybe': 0.34; 'received:google.com': 0.35; 'next': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'safe': 0.72; 'subject:get': 0.81; '2015': 0.84; 'moves': 0.84; 'otten': 0.84; 'convinced': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=s0jEc72Rx+eriWQ8RaGsqFpYox+ptfuiEjqH8U9luQU=; b=wo4LI4D1/EcUcC8yAeZT8ImLLzALe+Ci3iu53pqR9vYfVb12Gw3HQL0yrAP91khpaT ql+niogx4l3MV3MgNtFkelNi5zoOFty38bLizKEWqlskYO7yTuCbWtmlMnxjFbx/wc+n bc+wNcxJe899es0kffBe2xO4IdXns+qu8aH6UHi5xc2FgKCZekkaDIMfP8y2MlEW5sO1 RSa6al+JSJR7nM8mlqBRk682Y5+f3+7Flpmr3zG+gl4euXA3ZflbWe/7YUnjmuTdM62N 2o7i3sRpmPD78gwt9SxIjRfV1/XfY0ngDzUyW6Qzk5BMrGvha/2u0J/cfbXUNNIJz3C3 fVAQ== |
| X-Received | by 10.50.142.98 with SMTP id rv2mr13926018igb.11.1430753670846; Mon, 04 May 2015 08:34:30 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <mi82i2$tlo$1@ger.gmane.org> |
| References | <3c45772b-77e0-4c17-8b3d-aa246c4b511c@googlegroups.com> <mi7n22$mbc$1@ger.gmane.org> <CAPTjJmp_5uZE1Zm2DVOG1CHDGYr9i1jLAOVaRaOVf8eXkE=btw@mail.gmail.com> <mi82i2$tlo$1@ger.gmane.org> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Mon, 4 May 2015 09:33:50 -0600 |
| Subject | Re: when does newlines get set in universal newlines mode? |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.93.1430753672.12865.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1430753672 news.xs4all.nl 2962 [2001:888:2000:d::a6]:57166 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:89911 |
Show key headers only | View raw
On Mon, May 4, 2015 at 9:17 AM, Peter Otten <__peter__@web.de> wrote:
> OK, you convinced me. Then I tried:
>
>>>> with open("tmp.txt", "wb") as f: f.write("0\r\n3\r5\n7")
> ...
>>>> assert len(open("tmp.txt", "rb").read()) == 8
>>>> f = open("tmp.txt", "rU")
>>>> f.readline()
> '0\n'
>>>> f.newlines
>>>> f.tell()
> 3
>>>> f.newlines
> '\r\n'
>
> Hm, so tell() moves the file pointer? Is that sane?
If I call readline() followed by tell(), I expect the result to be the
position of the start of the next line. Maybe this is considered safe
because tell() on a pipe raises an exception?
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
when does newlines get set in universal newlines mode? arekfu@gmail.com - 2015-05-04 02:50 -0700
Re: when does newlines get set in universal newlines mode? Peter Otten <__peter__@web.de> - 2015-05-04 14:01 +0200
Re: when does newlines get set in universal newlines mode? Chris Angelico <rosuav@gmail.com> - 2015-05-04 22:13 +1000
Re: when does newlines get set in universal newlines mode? Davide Mancusi <arekfu@gmail.com> - 2015-05-04 06:35 -0700
Re: when does newlines get set in universal newlines mode? Terry Reedy <tjreedy@udel.edu> - 2015-05-04 13:38 -0400
Re: when does newlines get set in universal newlines mode? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-05 18:31 +1000
Re: when does newlines get set in universal newlines mode? Chris Angelico <rosuav@gmail.com> - 2015-05-05 18:41 +1000
Re: when does newlines get set in universal newlines mode? Davide Mancusi <arekfu@gmail.com> - 2015-05-05 02:23 -0700
Re: when does newlines get set in universal newlines mode? Chris Angelico <rosuav@gmail.com> - 2015-05-05 19:28 +1000
Re: when does newlines get set in universal newlines mode? Davide Mancusi <arekfu@gmail.com> - 2015-05-05 03:58 -0700
Re: when does newlines get set in universal newlines mode? Peter Otten <__peter__@web.de> - 2015-05-04 17:17 +0200
Re: when does newlines get set in universal newlines mode? Chris Angelico <rosuav@gmail.com> - 2015-05-05 01:26 +1000
Re: when does newlines get set in universal newlines mode? Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-04 09:33 -0600
csiph-web