Nov-29-2022, 06:50 PM
(Nov-29-2022, 06:12 PM)Larz60+ Wrote: Try this:
msgs = [ b'\x01\x80Q\x01\x00\x01\x12\x00\x00\x80Test Message 12345', b'7\x00\x00\x00You find many blocks, can you send me some coin please!', b'\x01T\x00\x00\x80{"market":"2","rate":"2600","account":"ltc1q3la84qedyf2745y8cel4wklgqalsvh8xjk7g2k"}' ] for msg in msgs: txt = str(msg).split('\\')[-1][3:-1] print(txt)results:
Output:Test Message 12345 You find many blocks, can you send me some coin please! {"market":"2","rate":"2600","account":"ltc1q3la84qedyf2745y8cel4wklgqalsvh8xjk7g2k"}
is it that easy? Man I'm the worst at splits.. can you talk through this? .split('\\')[-1][3:-1] looks like we split at \ then go back 3 what is the -1?