0 votes
in Programming by (580 points)

I have to load different texts paragraphs in a python program.

At the moment they are stored in a .txt file and they are separated with markers, something like:


text of paragraph1


text of paragraph2


After I've load the text in python, than I've used regex to divide the parts.

The problem with this approach is that my program is growing and I've reached something like 30 parts, I need another way to keep my program clean.

I was thinking to use a .json file not a .txt one. The problem in this case is that my text has a lot of special characters in it like ', $, '', """"", that are escape character for .json string, so I have problem to keep them also in python.

Is there a way to load text and keep the program clean?

Please log in or register to answer this question.