Python Forum
Newbie Start with Text or Table? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Newbie Start with Text or Table? (/thread-30358.html)



Newbie Start with Text or Table? - abrogard - Oct-17-2020

I'm totally new. Going to write a little thing to keep one or two hundred strings maybe 250 chars long is all.

Better to write them to a text file or better to get straight into tables in mysql or such?


RE: Newbie Start with Text or Table? - Larz60+ - Oct-17-2020

what you store your data as is very much dependent on what you plan to do with it after it is stored.

What is in the text? is it formatted in such a way that it can be retrieved by key?

Other formats may be appropriate, such as JSON file.

Show some sample data.


RE: Newbie Start with Text or Table? - Gribouillis - Oct-17-2020

You don't need a program to do that. Writing a text file sounds perfect.


RE: Newbie Start with Text or Table? - abrogard - Oct-17-2020

It's a little game for my small son. So I do need a program.

Essentially he wants to write in questions and get back random answers.

Nonsense is fine. He found something like this on the web and wants to do it himself, have the control to put in his own text.

well they might not be questions even so that it becomes a fake nonsense 'conversation'.


RE: Newbie Start with Text or Table? - Gribouillis - Oct-18-2020

You could perhaps try TinyDB for this persistence use case. Its usage is straightforward.


RE: Newbie Start with Text or Table? - jefsummers - Oct-18-2020

To keep it simple for adding new strings and editing strings, I'd go ahead and use a text file, then read the strings in and pick random strings to display.

Other methods are fine and certainly have advantages. But, they will require you to write a "maintenance" section where you add and edit the strings. Text file avoids that as you can use Notepad or similar to make the modifications and use your program for the interaction.