Python Forum

Full Version: Concatenation ??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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'