diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2023-05-04 09:02:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-04 09:02:23 +0100 |
| commit | 6b200c68b4a2c0da08d591ddd1e19b81769d64a8 (patch) | |
| tree | 7cfc71fb44b92d1c701ad2b095f05f049685c132 /challenge-024/paulo-custodio/python/ch-2.py | |
| parent | 97f7c0542dc51b3fb7f36c0ecdf0a761084bfdc6 (diff) | |
| parent | ba1f9c9bba63dc84941143530dfe11619386f90e (diff) | |
| download | perlweeklychallenge-club-6b200c68b4a2c0da08d591ddd1e19b81769d64a8.tar.gz perlweeklychallenge-club-6b200c68b4a2c0da08d591ddd1e19b81769d64a8.tar.bz2 perlweeklychallenge-club-6b200c68b4a2c0da08d591ddd1e19b81769d64a8.zip | |
Merge pull request #8013 from pauloscustodio/master
Add solutions
Diffstat (limited to 'challenge-024/paulo-custodio/python/ch-2.py')
| -rw-r--r-- | challenge-024/paulo-custodio/python/ch-2.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/challenge-024/paulo-custodio/python/ch-2.py b/challenge-024/paulo-custodio/python/ch-2.py index 7b3aff407a..6f4ab47bb9 100644 --- a/challenge-024/paulo-custodio/python/ch-2.py +++ b/challenge-024/paulo-custodio/python/ch-2.py @@ -47,6 +47,9 @@ def create_database(): word_id INTEGER ); ''') + cur.execute(''' + CREATE UNIQUE INDEX found_index ON found(document_id, word_id); + ''') con.commit() con.close() @@ -94,7 +97,7 @@ def add_found(con, document_id, word_id): def add_doc(file): con = sqlite3.connect(DBFILE) - title = os.path.basename(file) + title = re.sub(r"\.\w+$", "", os.path.basename(file)) document_id = get_document_id(con, title) # read document |
