Merge pull request #65 from TiagoRG/dev-tiagorg

[LABI] renamed 1ano/2semestre/labi/tema02/src/Calculater/ -> 1ano/2semestre/labi/tema02/src/Calculator/
[LABI] tema06 src added

LICENSE creation merge
This commit is contained in:
Tiago Garcia 2023-05-22 17:17:57 +01:00 committed by GitHub
commit 90984ccb5f
Signed by untrusted user who does not match committer: TiagoRG
GPG Key ID: DFCD48E3F420DB42
6 changed files with 27 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,27 @@
import sqlite3 as sql
import sys
def main(args=None):
db = sql.connect('database.db')
result = db.execute('SELECT * FROM contacts')
rows = result.fetchall()
for row in rows:
print(row)
for row in rows:
print(row[0], row[1], row[2])
print()
try:
result = db.execute('SELECT * FROM contacts WHERE first_name LIKE ?', (args[0],))
print(result.fetchall()[0][4])
except IndexError:
print('Contact not found')
db.close()
if __name__ == '__main__':
main(sys.argv[1:])