Python Forum
Newbie Start with Text or Table?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie Start with Text or Table?
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?
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.
You don't need a program to do that. Writing a text file sounds perfect.
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'.
You could perhaps try TinyDB for this persistence use case. Its usage is straightforward.
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.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fetch Oracle DB rows & print it in HTML file with table's col headers in table format tssr_2001 1 489 Sep-04-2020, 01:39 PM
Last Post: ibreeden
  Mysql CREATE TABLE IF NOT EXISTS dynamic table name nisusavi 0 394 Apr-29-2020, 06:45 PM
Last Post: nisusavi
  MYSQL how to assign a table for each user in my username table database? YoshikageKira 1 843 Dec-26-2019, 05:57 AM
Last Post: buran
  HELP: Combine records in a table with missing start or end date Techy_RN 1 470 Dec-16-2019, 08:51 PM
Last Post: Clunk_Head
  Converting a patterned string or text into excel table soup1987 1 612 Oct-03-2019, 01:37 AM
Last Post: Larz60+
  Python QGIS tool that replaces layout text labels with attributes from an input table geodenn92 1 753 Aug-13-2019, 06:05 AM
Last Post: buran
  How do i read particular text from text file and update those values in MS SQL table ganeshsai2912 33 5,859 Nov-20-2018, 12:55 AM
Last Post: ganeshsai2912
  What's the difference b/w assigning start=None and start=" " Madara 1 902 Aug-06-2018, 08:23 AM
Last Post: buran
  convert text file data to HTML table in python Tirumal 5 7,497 Dec-29-2017, 04:44 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020