Python Programming 85 - Updating and Deleting Books through Console App

preview_player
Показать описание


~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
Рекомендации по теме
Комментарии
Автор

About this funky code at 3:20 : you can do it in a different yet more compact way:
title = input("What is the current title? ")
pages = input("What is the current no of pages? ")

uchicha
Автор

I’m first today but I swear I no nothing about programming but I wanna learn

bfoster
Автор

for updating i found this to be a lot better

def update_book(title:str, updated_title:str, updated_pages:int):
c = get_cursor()
with c.connection:
c.execute("SELECT rowid FROM books WHERE title=? LIMIT 1 ", (title, ))
row = c.fetchone()
c.execute("UPDATE books SET title =?, pages =? WHERE rowid =?", (updated_title, updated_pages, row[0], ))
c.connection.close()

this way you don't need to know the current page. it uses the current title to find the rowid which is then used to do the update

JoshStasio
Автор

Great series! You still need to close the connection even if you are using "with c.connection"?

etienneb
Автор

Can you please make Robinhood stock trading app or GeForce now cloud gaming from nivida in java Android studio if you can

joshuaadinku
join shbcf.ru