Search code examples
pythontextreplaceformattingconventions

Formatting text that is meant to be replaced


This is a rather generic question, but I have a textfile that I want to edit using a script.

What are some ways to format text, so that it will visually stand out but still be recognized by my script? It works fine when I use text_to_be_replaced, but it is hard to find when you have a large file.

Tried searching, and it seems that the common ways are:

%text_to_be_replaced% 
<text_to_be_replaced>
$(text_to_be_replaced)

But maybe there is a commonly used/widely accepted way to format text for visibility?

The language the script is written in is python, if that matters... but I'm looking for a more-or-less generic soluting which will work 90% of the time.


Solution

  • At first I thought that {{curly braces}} would be fine, but than I went with $ALLCAPS.

    First of all, caps really stands out, while lowercase may be confused with the rest of the code. And while it $REALLYSTANDSOUT, it shouldn't cause any problems, since it's just a "bookmark" in a text file, and will be replaced with the appropriate stuff determined by the script.