Python's repr()
method converts strings to their raw value.
So that:
aa a
Hello
Becomes
aa a\nHello
I tried to do the same in a node.js script with util.inspect
but it had converted:
GET / HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
to
'GET / HTTP/1.1\r\n' +
'Host: localhost:8081\r\n' +
'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0\r\n' +
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n' +
'Accept-Language: en-US,en;q=0.5\r\n' +
'Accept-Encoding: gzip, deflate\r\n' +
'Connection: keep-alive\r\n' +
'Upgrade-Insecure-Requests: 1\r\n' +
'\r\n'
Q
How do I get the same results as python's repr
, without the un-necessary + signs and concatenations? (it should be one long string).