Please help on print string that contains 'tab' and 'newline'
Jason Qian
jqian at tibco.com
Sat Jan 27 20:39:38 EST 2018
Thanks for taking look this.
The source of the string is std::string from our c code as callback .
On the python side is shows as bytes.
Is there way we can reformat the string that replace \r\n with newline, so
python can correctly print it ?
Thanks
On Sat, Jan 27, 2018 at 5:39 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 1/27/2018 3:15 PM, Jason Qian via Python-list wrote:
>
>> HI
>>
>> I am a string that contains \r\n\t
>>
>> [Ljava.lang.Object; does not exist*\r\n\t*at
>> com.livecluster.core.tasklet
>>
>>
>> I would like it print as :
>>
>> [Ljava.lang.Object; does not exist
>> tat com.livecluster.core.tasklet
>>
>
> Your output does not match the input. Don't add, or else remove, the *s
> if you don't want to see them. Having '\t' print as ' t' makes no sense.
>
> In IDLE
>
> >>> print('[Ljava.lang.Object; does not exist*\r\n\t*at
> com.livecluster.core.tasklet')
> [Ljava.lang.Object; does not exist*
> *at com.livecluster.core.tasklet
>
> IDLE ignores \r, other display mechanisms may not. You generally should
> not use it.
>
> Pasting the text, with the literal newline embedded, does not work in
> Windows interactive interpreter, so not testing this there.
>
>
> --
> Terry Jan Reedy
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list