Hello, I am new to Python. I am below scenario. if someone can help me how it be achieved in python. please let me know

I have a file named ‘line.txt’ which has below sample lines. there could be more similar lines in this file .


# Build 74
* [52e3ea1](https://gitlab.com/jenkins-code/nancy-jenkins-helm/commit/52e3ea1) [abc] **Testing Change 1*
* [52e3ea2](https://gitlab.com/jenkins-code/nancy-jenkins-helm/commit/52e3ea2) [abc] **Testing Change 2*

what i want is to convert above file to below using python.

# Build 74
<p>* <a href=\"https://gitlab.com/jenkins-code/nancy-jenkins-helm/commit/52e3ea1\">52e3ea1</a> [abc] **Testing Change 1* </p>
<p>* <a href=\"https://gitlab.com/jenkins-code/nancy-jenkins-helm/commit/52e3ea2\">52e3ea2</a> [abc] **Testing Change 2* </p>

You can do this with the Markdown package: Markdown · PyPI

2 Likes

I would use regex (the re module).

Part of learning to get help is learning to write good titles. Something like ‘Converting markdown to html’ would be better.

4 Likes