Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Error handling using cmd module
Post: RE: Error handling using cmd module

Here is my solution: Every command has the following template: def do_eat(self, arg): try: # eat except Exception as exc: return excThen I print the error...
leifeng General Coding Help 3 2,915 Jun-06-2020, 06:25 PM
    Thread: Error handling using cmd module
Post: Error handling using cmd module

I'm using Python's cmd module to write my own command line interpreter. I'm not sure how to handle errors using the modules. Let's say my command eat requires 1 argument. The function usually goes a...
leifeng General Coding Help 3 2,915 Jun-04-2020, 05:48 AM
    Thread: Double for loop with dates in array
Post: RE: Double for loop with dates in array

I've written some code that does the work but it is horribly structured: cursor.execute("""SELECT * FROM log""") records = cursor.fetchall() date_index = date.fromisoformat(records[0][2]...
leifeng General Coding Help 1 1,641 Apr-05-2020, 03:27 PM
    Thread: Double for loop with dates in array
Post: Double for loop with dates in array

I have a SQLite database that I've selected into an array cursor where each row has a date element. I've already sorted cursor by date. I effectively have something like: cursor = [ [data1, "dat...
leifeng General Coding Help 1 1,641 Apr-05-2020, 12:11 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020