booklst1a.py
来自「python web programming 部分」· Python 代码 · 共 47 行
PY
47 行
PUBLISHER = {
1: (1, "New Riders", "www.newriders.com"),
2: (2, "O'Reilly", "www.ora.com")
}
AUTHOR = {
1: (1, "David", "Beazley", "USA"),
2: (2, "Steve", "Holden", "USA"),
3: (3, "Mark", "Lutz", "USA"),
4: (4, "David", "Ascher", "USA"),
5: (5, "Mark", "Hammond", "Australia"),
6: (6, "Andy", "Robinson", "UK")
}
BOOK = {
"0000000001": ("0000000001",
(1, ),
"Python Essential Reference",
1,
2001),
"0000000002": ("0000000002",
(2, ),
"Web Programming in Python",
1,
2001),
"0000000003": ("0000000003",
(3, 4),
"Learning Python",
2,
1999),
"0000000004": ("0000000004",
(5, 6),
"Programming Win32 on Python",
2,
1999)
}
for b in BOOK.keys():
Bookid, authids, booktitle, pubid, bookyear = BOOK[b]
print "%12s %-20s %-30s %-12s %d" % (
Bookid, # ISBN
" and ".join([AUTHOR[i][2] for i in authids]),
booktitle,
PUBLISHER[pubid][1],
bookyear)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?