Week 4 class demo

import pathlib
out = pathlib.Path('deleteme.txt')

out.write_text('hello, this will go away')
24
print(out.exists())
True
if out.exists():
    out.unlink()
print(out.exists())
False
import shutil
shutil.unpack_archive('records.zip')
shutil.rmtree('records')
import sqlite3
conn = sqlite3.connect('pettigrew.db')
c = conn.cursor()
results = c.execute('SELECT name from sqlite_master where type= "table"')

Last updated

Was this helpful?