[Python] Python cut text in pieces to upload to Wordpress Blog

Discussão em 'Python' iniciado por Stack, Julho 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have a piece that already has some formatting. Now I need to convert this to a format so I can use the Wordpress API to send it to wordpress.

    This is an example of my text:

    '**H1: Some text**\n\nSome text as paragraph.\n\n**H2: A subheader**\n\nText from the subheader.\n\nA line break with some more text.\n\n**H2: Another sub hearder**\n\n**H3: A sub sub header


    I tried this:

    test = myFullText
    header1 = re.findall('H1.*?ph.', test)


    And

    test = myFullText
    header1 = re.findall('H1.*?\n\n.', test)


    Both give me empty "header1"

    More general question. I assume the findall function is the best approach for my use case. Or is there another option to achieve this. Like I mentioned. My ultimate goal is to create a Wordpress blogpost from this text.

    Continue reading...

Compartilhe esta Página