Quote:
Originally Posted by carmenchu
I have implemented a variant of your suggestion, and (I hope!) avoided the trouble of a void "tags": "", getting the "tags" preferences obliterated on next run.
|
Unfortunately,
Code:
ttags = [True,prefs['tags'].split(',')][len(prefs['tags']) > 0 or 0] # evaluates to 1|0 for tags|no tags
doesn't work for empty strings. Since it was my idea anyway, simply remove the part that checks for empty strings.
Quote:
Originally Posted by carmenchu
It's an option which I wouldn't recommend, save for report purposes: one can achieve the same result by a simple search & replace of class="calibre\d*"
|
Indeed. Maybe it isn't a good idea to have such an option.
Quote:
Originally Posted by carmenchu
By the way, is there a simple way of getting the list of tags ordered? It would be easier to read and edit, but I can't get it done...
|
The built-in
sort() function should also work for lists.
BTW, one other free Python book I can highly recommend is
Automate the Boring Stuff with Python by Al Sweigart, which is available online and as a paid e-book.