[Tutor] make a sqlite3 database from an ordinary text file

dn PythonList at DancesWithMice.info
Sun Jun 19 22:39:14 EDT 2022


On 20/06/2022 12.59, Manprit Singh wrote:
> Dear all,
> Learning is a lifelong process . At this point i still do not feel i am
> absolutely ok with python or programming. In the past i was very active in
> this mailing list and will appreciate a few - Alan sir, Dennis Lee Bieber,
> dn and few others, they always answered my queries .
> As i wrote in the starting , i have a simple text file named abcd.txt. (I
> am not using a csv file or any other structured file) . The contents are
> given below :
> 
> Time  Pieces
> 1       10
> 2       15
> 3       25
> 4       31
> 5       40
> 6       45
> 7       53
> 8       54
> 9       65
> 10      75
> 
> We can clearly see the first line of the file is
> 
> Time  Pieces

but, as advised earlier, whilst "we can clearly see" is true IN THIS
CASE; what happens when someone brings another table to the party?

Ref: https://xkcd.com/327/

BTW my favorite joke from this genre is:

    π = 3.141592653589793helpimtrappedinapiefactory7108914...


I'm +1 after @Alan. Although we often see it in programming texts, I've
NEVER initialised a DB/TBL this way. Easy for me to say: I learned RDBMS
and SQL very early in my career, and therefore know to use the tools
from that eco-system. (the rationale in books is the exact opposite -
presuming the reader has never used DB-tools). Use the best tool for the
job!


With regard to "Learning is a lifelong process", most?all of us here
will whole-heartedly agree. Those who don't have little reason to
subscribe to this list!

However, rather than spending years (it must surely be) working on small
and simple (and at-times, artificial or academic) problems - even to the
point of seeking the most efficient of solutions (to same); there comes
a time to stop "learning" per-se, and start 'doing'!

The best way to learn how to USE Python to solve 'real-world' problems
is to use it - in 'the real-world'! Pick a project that will require
multiple classes, several modules, or hundreds of lines of code; and
dive in!

Given that we've ventured into a multi-media discussion. Here is the
very first PyBites podcast (out of more than 70, over the years). It
espouses a solid 'learn by doing' mind-set and (IIRC) talks of
"JiT-learning" (start from a solid base, and then learn what you
need-to, when you need to): https://www.youtube.com/watch?v=NoTkCSP3A68
- or in a component of my understanding of "refactoring": 'there must be
a better way'...

-- 
Regards,
=dn


More information about the Tutor mailing list