summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2012-02-12 14:41:42 +0100
committerFlorian Bruhin <me@the-compiler.org>2012-02-12 14:41:42 +0100
commitdcb6060bae34f3c162c900f4f591717806fd05ac (patch)
treec71b8efe173dfdecb8145f146980bc538d0e562f
parent0280d25dd397dd9bc64a2bb92d8d71a8d24d0823 (diff)
downloadwebopac-dcb6060bae34f3c162c900f4f591717806fd05ac.tar.gz
webopac-dcb6060bae34f3c162c900f4f591717806fd05ac.zip
pretty printing
-rw-r--r--webopac.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/webopac.py b/webopac.py
index a39525e..b153b9f 100644
--- a/webopac.py
+++ b/webopac.py
@@ -67,20 +67,24 @@ def init():
initlog(options)
return (options, args)
-def main():
- (options, args) = init()
- f = get_webopac_data(args[0], baseurl=options.baseurl)
- data = decode_csv(f)
+def printdata(data):
+ data = (elem for elem in data if ' # CD_' in elem['Signatur'])
+
for row in data:
- if " # CD_" in row['Signatur']:
formatdict={
'title': row['Titel'],
'author': row['Autor'],
'year': row['Erscheinungsjahr'],
+ 'sig': row['Signatur'],
}
- print("Title: {title}\nAuthor: {author}\n"
- "Year: {year}".format(**formatdict))
- print()
+ print("Title: {title}\nAuthor: {author}\n"
+ "Year: {year}\nSignatur: {sig}\n".format(**formatdict))
+
+def main():
+ (options, args) = init()
+ f = get_webopac_data(args[0], baseurl=options.baseurl)
+ data = decode_csv(f)
+ printdata(data)
if __name__ == '__main__':
main()