Response for PING in ircbot.
dn
PythonList at DancesWithMice.info
Wed Feb 3 23:30:55 EST 2021
On 04/02/2021 07.07, Dennis Lee Bieber wrote:
> On Tue, 02 Feb 2021 20:26:34 -0500, Random832 <random832 at fastmail.com>
> declaimed the following:
>
>
>> 1. It looks like you're forgetting to send \n\r
>
> Isn't the convention \r\n -- from the days of teletype, when the return
> took longer to complete than the line feed, so start return, have it finish
> while the line feed activates...
Yes, "CRLF" = Carriage Return (chr( 13 )) and Line-Feed (chr( 10 )).
> The order didn't matter in the .strip() call as that strips any
> leading/trailing characters that match any of the provided set, it is not a
> "trim" of the exact sequence (hmm, looks like that would be require using
> string.removeprefix("\n\r").removesuffix("\n\r") if the expected sequence
> were such).
If every line ends with the same (odd) suffix, then why not slice the
string [ :-2 ]?
Alternately, consider str.translate() where both character codes are
removed, regardless of location.
--
Regards,
=dn
More information about the Python-list
mailing list