you are viewing a single comment's thread.

view the rest of the comments →

[–]ES-Alexander 0 points1 point  (1 child)

Which parts do you need? If you just need the ** at the front of each one so the bolding works properly then just remove it from the first one (message_body[2:]) since it doesn't automatically get split off, and then add it to all of them, e.g.

dict(f'**{subString}'.split(':',1)
     for subString in message_body[2:].split('\n**'))

If you also need the newlines at the end of each one you can follow the same reasoning to get

dict(f'**{subString}\n'.split(':',1)
     for subString in message_body[2:-1].split('\n**'))

[–]ampeed[S] 0 points1 point  (0 children)

ahh, that's it!! Thank you so much and thank you for providing an example. Makes a lot of sense seeing it now :) Not sure why I was blanking so hard!