|
|
#1 |
|
Member
![]() Posts: 23
Karma: 10
Join Date: Jun 2016
Location: France
Device: PocketBook Touch Lux 2
|
Accessing Identifiers values with python
A newbie's question.
How do I list the different values in the identifiers field? I can access a given value (ISBN in this case) using the code below, but I'd like to access all the values. Thanks in advance. Code:
python:
def evaluate(book, context):
isbn = book.get('identifiers').get('isbn', '')
|
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,216
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Code:
python:
def evaluate(book, context):
res = ''
for k, v in book.get('identifiers').items():
res += f'{k}: {v}\n'
return res
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Member
![]() Posts: 23
Karma: 10
Join Date: Jun 2016
Location: France
Device: PocketBook Touch Lux 2
|
Perfect!
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PG Identifiers | Comfy.n | Library Management | 2 | 09-03-2024 08:39 AM |
| Converting ePub Python coding books to PDF outputs Python code far too small | lysakowski | Conversion | 9 | 04-30-2023 06:44 AM |
| Python 2 to Python 3, Polyglot & Plugins | DaltonST | Calibre | 18 | 04-24-2019 01:10 AM |
| Python error when accessing content server with calibredb | drawson1 | Library Management | 1 | 06-19-2018 01:08 PM |
| Accessing the database from Python | richlyon | Development | 2 | 12-13-2011 12:43 PM |