I'm developing a CLI app for connecting to WPE's API, meanwhile teaching myself some Python. I hit the API and populate a local sqlite database, and then display the records from that database.
# pull all our installs
_ins = self._db.get_all_installs( )
# fire up and index
_idx = 1
# fire up a dict object to hold the selectable item
_selectable = []
# loop over the results
for _row in _ins:
# gather up some info and through them into re-usable variables
_wpe_id = _row[2]
_name = _row[3]
_environ = _row[4]
# build a "menu" string
_menu_str = "{}) {} - {}".format( _idx, _name, _environ )
# add the items to a dict object
_selectable.append( _wpe_id )
# increment the index
_idx += 1
# display the item
if _idx % 3 == 0:
print("here, maybe??")
# display the item
print( _menu_str )
What I am struggling with in figuring out is how I can get this to break up the single-line single-row output. Essentially what I would like to do is see this as a 3 column "menu". How can I do this?
Right now, I have over 300 records, which outputs 1 line at a time. Like:
1) Row 1
2) Row 2
3) Row 3
What I would like to do is like:
1) Row 1 2) Row 2 3) Row 3
etc...
How can I do this?