Csv2html2 Opt.py

-B option, interpreter, 199 backreferences, regex, 495 backtrace; see traceback backups, 414

base64 module, 219,220-221 basename() (os.path module), 223 Berkeley DB, 475 bigdigits.py (example), 39-42 BikeStock.py (example), 332-336 bin() (built-in), 55,253 binary data, 220 binary files, 295-304, 324-336 binary numbers, 56 binary search, 272

see also bisect module BinaryRecordFile.py (example),

324-332 bindings, event, 576 bindings, keyboard, 576 bisect module, 217, 272 bit_length() (int type), 57 bitwise operators, table of, 57 block structure, using indentation, 27

blocks.py (example), 525-534,

543-547, 559-562 BNF (Backus-Naur Form),

515-518 bookmarks-tk.pyw (example), 578-593

bool() (built-in), 58,250, 309 conversion, 58 Boolean expressions, 26, 54 branching; see if statement branching, with dictionaries,

340-341 break (statement), 161,162

built-in abs(), 55, 56, 96,145, 253 aH(), 140, 184,396,397 any(), 140, 205,396,397 ascii(), 68, 83 bin(), 55,253 bool(),58,250,309 chr(), 67, 90, 504 @classmethod(), 257, 278 compile(), 349 complex(), 63,253 delattr(), 349 dict(), 127,147 dir(), 52,172, 349,365 divmod(), 55, 253 enumerated, 139-141, 398, 524 eval(), 242, 243,258,266,275,

filter(), 395, 397 float(), 61, 154, 253 format(),250,254 frozenset(), 125

391, 409 globals(), 345, 349 hasattr(), 270, 349,350,391 hash(), 241,250,254 help(),61,172 hex(), 55,253 id(), 254

__import__() , 349, 350 input(), 34, 96 int(), 55, 61,136,253,309 isinstance(), 170,216, 242,270,

382, 390, 391 issubclass(), 390 iter(), 138,274, 281 len(), 71, 114,122,140,265, 275 list(), 113, 147

190, 345, 349, 422, 423, 484 map(), 395, 397, 539 max(), 140, 154,396,397

min(), 140,396,397 next(), 138, 343, 401 oct() , 55, 253 ord(), 67, 90,364 pow(), 55

print(), 11, 180,181,214,422 @property(), 246-248, 376, 385, 394

reversed(), 72,140,144, 265, 274 round(), 55, 56, 61,252,253, 258 set(), 122,147 setattr(), 349, 379,409 sorted(), 118,133, 140,144-146, 270

@staticmethod(),255

381,385 tuple(), 108 type(), 18, 348, 349 vars(), 349

builtins module, 364

Button type (tkinter module), 581,

591 byte-code, 198 byte order, 297 bytearray type, 293, 301, 383, 418-419,462 append(),299 capitalized, 299 center(), 299 count(), 299

endswith(), 299 expandtabs(), 299 extend(), 299, 301, 462 find(), 299

bytearray type (cont.) fromhex(), 293,299 index(), 299 insert(),293, 299 isalnum(), 299 isalpha(), 299 isdigit(), 299 islower(), 299 isspace(), 299 istitle(), 300 isupper(), 300 join(), 300 ljust(), 300 lower(), 300 lstrip(), 300

methods, table of, 299, 300, 301 partition(), 300 pop(), 293, 300 remove(), 300 replace(), 293,300 reverse(), 300 rfind(), 299 rindex(), 299 rjust(), 300 rpartition(), 300 rsplit(), 300 rstrip(), 300 split(), 300 splitlines(), 300 startswith(), 300 strip(), 300 swapcase(), 300 title(), 300 translate(), 300 upper(), 293, 301 zfill(), 301 bytes type, 93, 293, 297, 383, 418-419 capitalize(), 299 center(), 299 count(), 299

302, 326, 336, 418, 443 endswith(),299 expandtabs(),299

bytes type (cont.) find(),299 fromhex(), 293,299 index(), 299 isalnum(), 299 isalpha(), 299 isdigit(), 299 islower(), 299 isspace(), 299 istitle(), 300 isupper(), 300 join(), 300 literal, 93, 220 ljust(), 300 lower(), 300 lstrip(), 300

methods, table of, 299, 300, 301 partition(), 300 replace(), 293,300 rfind(), 299 rindex(), 299 rjust(), 300 rpartition(), 300 rsplit(), 300 rstrip(), 300 split(), 300 splitlines(), 300 startswith(), 300 strip(), 300 swapcase(), 300 title(), 300 translate(), 300 upper(), 293, 301 zfill(), 301 .bz2 (extension), 219 bz2 module, 219

-c option, interpreter, 198 calcsize() (struct module), 297 calendar module, 216

call() (subprocess module), 209 callable; see functions and methods Callable ABC (collections module),

383, 391 callable objects, 271,367 capitalize()

bytearray type, 299 bytes type, 299 str type, 73 captures, regex, 494-495, 506 car_registration_server.py (example), 464-471 car_registration.py (example),

458-464 case statement; see dictionary branching category() (unicodedata module), 361

bytearray type, 299 bytes type, 299 str type, 73 cgi module, 225 cgitb module, 225 chaining exceptions, 419-420 changing dictionaries, 128 changing lists, 115 character class, regex, 491 character encodings, 9, 91-94, 314 see also ASCII encoding, Latin 1 encoding, Unicode CharGrid.py (example), 207-212 chdir() (os module), 223 checktags.py (example), 169 choice() (random module), 142 chr() (built-in), 67,90,504 class (statement), 238, 244, 378, 407

class, mixin, 466

class decorators, 378-380,407-409 class methods, 257 class variables, 255, 465 classes, immutable, 256, 261

dict type, 129 set type, 123 close()

connection object, 481 coroutines, 399,401,402 cursor object, 482 file object, 131,167, 325 closed attribute (file object), 325 closures, 367, 369 cmath module, 63 code comments, 10 collation order (Unicode), 68-69 collections; see dict, list, set, and tuple types collections, copying, 146-148 collections module, 217-219, 382 Callable ABC, 383, 391 classes, table of, 383 Container ABC, 383 defaultdict type, 135-136, 153,

183, 450 deque type, 218, 383 Hashable ABC, 383 Iterable ABC, 383 Iterator ABC, 383 Mapping ABC, 383 MutableMapping ABC, 269, 383 MutableSequence ABC, 269, 383 MutableSet ABC, 383 namedtuple type, 111-113,234,

365, 523 OrderedDict type, 136-138,218 Sequence ABC, 383 Set ABC, 383 Sized ABC, 383 combining functions, 395-397,

403-407 command-line arguments; see sys.argv list comment character (#), 10 commit() (connection object), 481, 483

comparing files and directories, 223

comparing objects, 23, 242 comparing strings, 68-69 comparisons; see <, <=, ==, !=, >, and

>= operators compile() built-in, 349

complex() (built-in), 253 Complex ABC (numbers module), 381 complex type, 62-63, 381 complex() (built-in), 63,253 conjugate(), 62 imag attribute, 62 real attribute, 62 composing functions, 395-397,

403-407 composition, 269 comprehensions; see under dict, list, and set types compressing files, 219 concatenation of lists, 114 of strings, 71 of tuples, 108 concepts, object-oriented, 235 conditional branching; see if statement conditional expression, 160, 176, 189

configparser module, 220, 519 configuration files, 220 conjugate() (complex type), 62 connect() (sqlite3 module), 481 connection object close(), 481 commit(),481,483 cursor(), 481,483 methods, table of, 481 rollback(), 481 see also cursor object constant set; see frozenset type constants, 149,180, 364-365

Container ABC (collections module), 383

context managers, 369-372, 452,

464, 466 contextlib module, 370,466 continue (statement), 161,162 conversions, 57

date and time, 217 float to int, 61 int to character, 67 int to float, 61 to bool, 58 to complex, 63 to dict, 127 to float, 59, 154 to int, 15, 55 to list, 113,139 to set, 122 to str, 15, 65 to tuple, 108, 139 convert-incidents.py (example), 289-323

Coordinated Universal Time (UTC), 216

copy module, 147, 275, 282, 469 dict type, 129, 147 frozenset type, 123 set type, 123, 147 copy module, 245

copy(), 147,275, 282,469 deepcopy(), 148 copying collections, 146-148 copying objects, 245 copysign() (math module), 60 coroutines, 399-407 close(), 399, 401,402 decorator, 401 send(),401,402,405, 406 cos() (math module), 60 cosh() (math module), 60 count()

bytearray type, 299

count() (cont.) bytes type, 299 list type,115 str type, 73, 75 tuple type, 108 cProfile module, 360,432, 434-437 CREATE TABLE (SQL statement), 481 creation, of objects, 240 .csv (extension), 220 csv module, 220 csv2html.py (example), 97-102 csv2html2_opt.py (example), 215 ctypes module, 229 currying; see partial function application cursor() (connection object), 481,

483 cursor object arraysize attribute, 482 close(), 482

description attribute, 482 execute(), 481,482,483,484,485,

486, 487 executemany(), 482 fetchall(),482,485 fetchmany(), 482 fetchone(), 482,484, 486 methods, table of, 482 rowcount attribute, 482 see also connection object custom exceptions, 168-171,208 custom functions; see functions custom modules and packages, 195-202

0 0

Post a comment