Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102963
| From | Random832 <random832@fastmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: repr( open('/etc/motd', 'rt').read() ) |
| Date | 2016-02-15 09:47 -0500 |
| Message-ID | <mailman.142.1455547651.22075.python-list@python.org> (permalink) |
| References | <n9sie9$91s$1@dont-email.me> |
On Mon, Feb 15, 2016, at 08:05, Veek. M wrote: > What is happening with # 1 # (repr)? > repr calls __repr__ which gives you bytes.. why does this result in \\n When you call a function that returns a string directly in the interpreter prompt (i.e. without print), it passes the result to repr, which means in this case repr has been called twice.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
repr( open('/etc/motd', 'rt').read() ) "Veek. M" <vek.m1234@gmail.com> - 2016-02-15 18:35 +0530
Re: repr( open('/etc/motd', 'rt').read() ) Random832 <random832@fastmail.com> - 2016-02-15 09:47 -0500
Re: repr( open('/etc/motd', 'rt').read() ) Terry Reedy <tjreedy@udel.edu> - 2016-02-15 15:03 -0500
Re: repr( open('/etc/motd', 'rt').read() ) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-16 17:43 +1100
csiph-web