Re: repr( open('/etc/motd', 'rt').read() )

2016-02-15 Thread Steven D'Aprano
On Tuesday 16 February 2016 00:05, Veek. M wrote: > When I do at the interpreter prompt, > repr( open('/etc/motd', 'rt').read() ) Opening and reading MOTD is a needless distraction from your actual question. This demonstrates the issue most simply: # at the inte

Re: repr( open('/etc/motd', 'rt').read() )

2016-02-15 Thread Terry Reedy
On 2/15/2016 8:05 AM, Veek. M wrote: When I do at the interpreter prompt, repr( open('/etc/motd', 'rt').read() ) i get # 1 #: When posting questions here or at Stackoverflow or elsewhere, it is a really good idea to develop and post a 'minimal, complete,

Re: repr( open('/etc/motd', 'rt').read() )

2016-02-15 Thread Random832
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, whic

repr( open('/etc/motd', 'rt').read() )

2016-02-15 Thread Veek. M
When I do at the interpreter prompt, repr( open('/etc/motd', 'rt').read() ) i get # 1 #: "'\\nThe programs included with the Debian GNU/Linux system are free software;\\nthe exact distribution terms for each program are described in the\\nindividual files in