I have a use case where I’d like to store a handful of strings with static values, alongside my code that references them. The general reason for not hard coding them where they’re called, is that I’d like to make it easy for the end user to customize and modify them.

Are there any suggestions or comments about the best ways to do this? Storing them in a python file as vars seems reasonable. I’ve also considered saving them as JSON, though I don’t know if there’s any benefit to that in this case.

Thoughts are appreciated.

  • rhacer@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    ·
    1 year ago

    I’d absolutely use a text file, one entry per line. Once you need to start associating other information with those strings, it becomes time for JSON or similar.