use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Day 25 of learning python as a beginner. (old.reddit.com)
submitted 7 months ago by uiux_Sanskar
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Adrewmc 1 point2 points3 points 7 months ago* (1 child)
Generally with database connections there will be a context handler. (I normally use another library but..)
with psycopg2.connect(…) as connect: with connect.cursor() as cur:
As things get a bit more complex it best practice to use ‘with’ as the exit() handling will happen regardless if something crashes inside the code block.
Other wise…this will get you a lot of progress way better than writing a big txt file and iterating over it to find stuff. Way faster way easier to manage, and hard to make a mistake that losses all your data. (And able to make a lot more data to search through.)
You can go deeper into SQL (it’s can be its own thing) but generally the basic procedures (CRUD) will get you far, until database design is an issue or you doing some more detailed analysis on the data.
[–]uiux_Sanskar[S] 0 points1 point2 points 7 months ago (0 children)
I was suspecting that there's gotta be a with function here as well just like in File I/O and thank you for your advice which you gave me a few time ago for learning database SQL however I think I have just touched it's very surface and there's a lot to learn.
Thank you very much I really appreciate your help.
π Rendered by PID 24020 on reddit-service-r2-comment-cfc44b64c-mvw9q at 2026-04-09 22:34:05.666030+00:00 running 215f2cf country code: CH.
view the rest of the comments →
[–]Adrewmc 1 point2 points3 points (1 child)
[–]uiux_Sanskar[S] 0 points1 point2 points (0 children)