Python Forum
Concatenation ?? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Concatenation ?? (/thread-29948.html)



Concatenation ?? - ridgerunnersjw - Sep-26-2020

I have a string that a user enters from input()....I would like to concatenate it with '\r' (0x0D) <CR> character so that it goes out on the uart bus as such.....

c = c + '\r'

If I print© before and after I get the same thing. How do I do this such that I don't get two different characters \, r on the UART port?

I have tried c =c + '\\r' but this does NOT yield the <CR> 0x06 on the UART.....

thanks


RE: Concatenation ?? - deanhystad - Sep-26-2020

What makes you think it isn't there? Just because you cannot see it?
a = 'Jello' + '\r'
print(a, len(a), a.__repr__())
Output:
Jello 6 'Jello\r'