ورود به حساب

نام کاربری گذرواژه

گذرواژه را فراموش کردید؟ کلیک کنید

حساب کاربری ندارید؟ ساخت حساب

ساخت حساب کاربری

نام نام کاربری ایمیل شماره موبایل گذرواژه

برای ارتباط با ما می توانید از طریق شماره موبایل زیر از طریق تماس و پیامک با ما در ارتباط باشید


09117307688
09117179751

در صورت عدم پاسخ گویی از طریق پیامک با پشتیبان در ارتباط باشید

دسترسی نامحدود

برای کاربرانی که ثبت نام کرده اند

ضمانت بازگشت وجه

درصورت عدم همخوانی توضیحات با کتاب

پشتیبانی

از ساعت 7 صبح تا 10 شب

دانلود کتاب The Python 3 Standard Library by Example

دانلود کتاب کتابخانه استاندارد پایتون 3 با مثال

The Python 3 Standard Library by Example

مشخصات کتاب

The Python 3 Standard Library by Example

دسته بندی: برنامه نويسي
ویرایش: Second 
نویسندگان:   
سری:  
ISBN (شابک) : 9780134291055 
ناشر: Addison Wesley 
سال نشر: 2017 
تعداد صفحات: 0 
زبان: English 
فرمت فایل : EPUB (درصورت درخواست کاربر به PDF، EPUB یا AZW3 تبدیل می شود) 
حجم فایل: 165 مگابایت 

قیمت کتاب (تومان) : 30,000



کلمات کلیدی مربوط به کتاب کتابخانه استاندارد پایتون 3 با مثال: #Doug Hellmann #Python3 #برنامه نویسی



ثبت امتیاز به این کتاب

میانگین امتیاز به این کتاب :
       تعداد امتیاز دهندگان : 7


در صورت تبدیل فایل کتاب The Python 3 Standard Library by Example به فرمت های PDF، EPUB، AZW3، MOBI و یا DJVU می توانید به پشتیبان اطلاع دهید تا فایل مورد نظر را تبدیل نمایند.

توجه داشته باشید کتاب کتابخانه استاندارد پایتون 3 با مثال نسخه زبان اصلی می باشد و کتاب ترجمه شده به فارسی نمی باشد. وبسایت اینترنشنال لایبرری ارائه دهنده کتاب های زبان اصلی می باشد و هیچ گونه کتاب ترجمه شده یا نوشته شده به فارسی را ارائه نمی دهد.


توضیحاتی در مورد کتاب کتابخانه استاندارد پایتون 3 با مثال

کتابخانه استاندارد Python 3 شامل صدها ماژول برای تعامل با سیستم عامل، مفسر و اینترنت است که همه آنها به طور گسترده آزمایش شده و آماده برای شروع سریع توسعه برنامه هستند. اکنون، داگ هلمان، متخصص پایتون، هر بخش اصلی کتابخانه Python 3.x را از طریق کد منبع مختصر و نمونه‌های خروجی معرفی می‌کند. مثال‌های هلمن هر ویژگی را به طور کامل نشان می‌دهند و برای یادگیری و استفاده مجدد آسان طراحی شده‌اند. کد عملی برای کار با متن، ساختارهای داده، الگوریتم‌ها، تاریخ/زمان‌ها، ریاضیات، سیستم فایل، پایداری، تبادل داده، فشرده‌سازی، آرشیو، رمزنگاری، فرآیندها/رشته‌ها، شبکه، قابلیت‌های اینترنت، ایمیل، توسعه‌دهنده و ابزارهای زبان، زمان اجرا، بسته ها و موارد دیگر. هر بخش به طور کامل یک ماژول را با پیوندهایی به منابع اضافی پوشش می دهد که این کتاب را به یک آموزش و مرجع ایده آل تبدیل می کند. کتابخانه استاندارد Python 3 by Example کتابخانه های جدید Python 3.x، تغییرات قابل توجه عملکرد، و طرح بندی و قراردادهای نامگذاری جدید را معرفی می کند. Hellmann همچنین برای انتقال کد از ماژول‌های کتابخانه استاندارد Python 2.x به معادل‌های Python 3.x خود، راهنمایی‌های تخصصی برای انتقال کد ارائه می‌کند. 1. متن را با رشته، textwrap، re (عبارات منظم)، و difflib دستکاری کنید 2. از ساختارهای داده استفاده کنید: enum، مجموعه ها، آرایه، heapq، صف، ساختار، کپی و موارد دیگر 3. الگوریتم‌ها را با ظرافت و مختصر با functools، itertools و contextlib پیاده‌سازی کنید 4. رسیدگی به تاریخ/زمان ها و وظایف ریاضی پیشرفته 5. آرشیو و فشرده سازی داده ها 6. درک تبادل و ماندگاری داده ها، از جمله json، dbm، و sqlite 7. پیام ها را به صورت رمزنگاری امضا و تأیید کنید 8. عملیات همزمان با فرآیندها و رشته ها را مدیریت کنید 9. ابزارهای تست، اشکال زدایی، کامپایل، نمایه، زبان، واردات و بسته بندی 10. تعامل در زمان اجرا با مفسرها یا محیط را کنترل کنید


توضیحاتی درمورد کتاب به خارجی

The Python 3 Standard Library contains hundreds of modules for interacting with the operating system, interpreter, and Internet–all extensively tested and ready to jump-start application development. Now, Python expert Doug Hellmann introduces every major area of the Python 3.x library through concise source code and output examples. Hellmann’s examples fully demonstrate each feature and are designed for easy learning and reuse. You’ll find practical code for working with text, data structures, algorithms, dates/times, math, the file system, persistence, data exchange, compression, archiving, crypto, processes/threads, networking, Internet capabilities, email, developer and language tools, the runtime, packages, and more. Each section fully covers one module, with links to additional resources, making this book an ideal tutorial and reference. The Python 3 Standard Library by Example introduces Python 3.x’s new libraries, significant functionality changes, and new layout and naming conventions. Hellmann also provides expert porting guidance for moving code from 2.x Python standard library modules to their Python 3.x equivalents. 1. Manipulate text with string, textwrap, re (regular expressions), and difflib 2. Use data structures: enum, collections, array, heapq, queue, struct, copy, and more 3. Implement algorithms elegantly and concisely with functools, itertools, and contextlib 4. Handle dates/times and advanced mathematical tasks 5. Archive and data compression 6. Understand data exchange and persistence, including json, dbm, and sqlite 7. Sign and verify messages cryptographically 8. Manage concurrent operations with processes and threads 9. Test, debug, compile, profile, language, import, and package tools 10. Control interaction at runtime with interpreters or the environment



فهرست مطالب

Cover......Page 1
Title Page......Page 5
Copyright Page......Page 6
Contents......Page 11
Introduction......Page 33
Acknowledgments......Page 35
About the Author......Page 37
1.1.1 Functions......Page 39
1.1.2 Templates......Page 40
1.1.3 Advanced Templates......Page 42
1.1.5 Constants......Page 44
1.2 textwrap: Formatting Text Paragraphs......Page 45
1.2.3 Removing Existing Indentation......Page 46
1.2.4 Combining Dedent and Fill......Page 47
1.2.5 Indenting Blocks......Page 48
1.2.7 Truncating Long Text......Page 50
1.3 re: Regular Expressions......Page 51
1.3.1 Finding Patterns in Text......Page 52
1.3.2 Compiling Expressions......Page 53
1.3.3 Multiple Matches......Page 54
1.3.4 Pattern Syntax......Page 55
1.3.5 Constraining the Search......Page 66
1.3.6 Dissecting Matches with Groups......Page 68
1.3.7 Search Options......Page 74
1.3.8 Looking Ahead or Behind......Page 82
1.3.9 Self-referencing Expressions......Page 86
1.3.10 Modifying Strings with Patterns......Page 91
1.3.11 Splitting with Patterns......Page 93
1.4.1 Comparing Bodies of Text......Page 96
1.4.2 Junk Data......Page 99
1.4.3 Comparing Arbitrary Types......Page 100
Chapter 2 Data Structures......Page 103
2.1.1 Creating Enumerations......Page 104
2.1.3 Comparing Enums......Page 105
2.1.4 Unique Enumeration Values......Page 107
2.1.5 Creating Enumerations Programmatically......Page 109
2.1.6 Non-integer Member Values......Page 110
2.2.1 ChainMap: Search Multiple Dictionaries......Page 113
2.2.2 Counter: Count Hashable Objects......Page 117
2.2.3 defaultdict: Missing Keys Return a Default Value......Page 121
2.2.4 deque: Double-Ended Queue......Page 122
2.2.5 namedtuple: Tuple Subclass with Named Fields......Page 127
2.2.6 OrderedDict: Remember the Order Keys Are Added to a Dictionary......Page 132
2.2.7 collections.abc: Abstract Base Classes for Containers......Page 135
2.3.1 Initialization......Page 136
2.3.2 Manipulating Arrays......Page 137
2.3.3 Arrays and Files......Page 138
2.3.4 Alternative Byte Ordering......Page 139
2.4.1 Example Data......Page 141
2.4.2 Creating a Heap......Page 142
2.4.3 Accessing the Contents of a Heap......Page 143
2.4.4 Data Extremes from a Heap......Page 145
2.4.5 Efficiently Merging Sorted Sequences......Page 146
2.5.1 Inserting in Sorted Order......Page 147
2.5.2 Handling Duplicates......Page 148
2.6 queue: Thread-Safe FIFO Implementation......Page 149
2.6.2 LIFO Queue......Page 150
2.6.3 Priority Queue......Page 151
2.6.4 Building a Threaded Podcast Client......Page 152
2.7.2 Packing and Unpacking......Page 155
2.7.3 Endianness......Page 156
2.7.4 Buffers......Page 158
2.8 weakref: Impermanent References to Objects......Page 159
2.8.2 Reference Callbacks......Page 160
2.8.3 Finalizing Objects......Page 161
2.8.4 Proxies......Page 164
2.8.5 Caching Objects......Page 165
2.9.1 Shallow Copies......Page 168
2.9.2 Deep Copies......Page 169
2.9.3 Customizing Copy Behavior......Page 170
2.9.4 Recursion in Deep Copy......Page 171
2.10.1 Printing......Page 174
2.10.2 Formatting......Page 175
2.10.3 Arbitrary Classes......Page 176
2.10.5 Limiting Nested Output......Page 177
2.10.6 Controlling Output Width......Page 178
3.1.1 Decorators......Page 181
3.1.2 Comparison......Page 189
3.1.3 Caching......Page 193
3.1.4 Reducing a Data Set......Page 196
3.1.5 Generic Functions......Page 199
3.2 itertools: Iterator Functions......Page 201
3.2.1 Merging and Splitting Iterators......Page 202
3.2.2 Converting Inputs......Page 205
3.2.3 Producing New Values......Page 207
3.2.4 Filtering......Page 210
3.2.5 Grouping Data......Page 213
3.2.6 Combining Inputs......Page 214
3.3.1 Logical Operations......Page 221
3.3.3 Arithmetic Operators......Page 222
3.3.4 Sequence Operators......Page 224
3.3.5 In-Place Operators......Page 225
3.3.6 Attribute and Item “Getters”......Page 226
3.3.7 Combining Operators and Custom Classes......Page 228
3.4.1 Context Manager API......Page 229
3.4.2 Context Managers as Function Decorators......Page 232
3.4.3 From Generator to Context Manager......Page 234
3.4.4 Closing Open Handles......Page 236
3.4.5 Ignoring Exceptions......Page 237
3.4.6 Redirecting Output Streams......Page 239
3.4.7 Dynamic Context Manager Stacks......Page 240
4.1.1 Comparing Clocks......Page 249
4.1.2 Wall Clock Time......Page 251
4.1.4 Processor Clock Time......Page 252
4.1.5 Performance Counter......Page 254
4.1.6 Time Components......Page 255
4.1.7 Working with Time Zones......Page 256
4.1.8 Parsing and Formatting Times......Page 257
4.2.1 Times......Page 259
4.2.2 Dates......Page 260
4.2.3 timedeltas......Page 263
4.2.4 Date Arithmetic......Page 264
4.2.6 Combining Dates and Times......Page 266
4.2.7 Formatting and Parsing......Page 268
4.2.8 Time Zones......Page 269
4.3.1 Formatting Examples......Page 271
4.3.3 Calculating Dates......Page 274
5.1.1 Decimal......Page 277
5.1.2 Formatting......Page 279
5.1.3 Arithmetic......Page 280
5.1.4 Special Values......Page 281
5.1.5 Context......Page 282
5.2.1 Creating Fraction Instances......Page 288
5.2.2 Arithmetic......Page 290
5.2.3 Approximating Values......Page 291
5.3.1 Generating Random Numbers......Page 292
5.3.3 Saving State......Page 293
5.3.4 Random Integers......Page 295
5.3.6 Permutations......Page 296
5.3.7 Sampling......Page 298
5.3.8 Multiple Simultaneous Generators......Page 299
5.3.9 SystemRandom......Page 300
5.3.10 Non-uniform Distributions......Page 301
5.4 math: Mathematical Functions......Page 302
5.4.2 Testing for Exceptional Values......Page 303
5.4.3 Comparing......Page 305
5.4.4 Converting Floating-Point Values to Integers......Page 308
5.4.5 Alternative Representations of Floating-Point Values......Page 309
5.4.6 Positive and Negative Signs......Page 310
5.4.7 Commonly Used Calculations......Page 312
5.4.8 Exponents and Logarithms......Page 316
5.4.9 Angles......Page 320
5.4.10 Trigonometry......Page 322
5.4.11 Hyperbolic Functions......Page 326
5.4.12 Special Functions......Page 327
5.5.1 Averages......Page 328
5.5.2 Variance......Page 330
Chapter 6 The File System......Page 333
6.1.1 Parsing Paths......Page 334
6.1.2 Building Paths......Page 338
6.1.3 Normalizing Paths......Page 339
6.1.4 File Times......Page 340
6.1.5 Testing Files......Page 341
6.2.2 Building Paths......Page 343
6.2.3 Parsing Paths......Page 345
6.2.5 Directory Contents......Page 347
6.2.7 Manipulating Directories and Symbolic Links......Page 350
6.2.8 File Types......Page 351
6.2.9 File Properties......Page 353
6.2.10 Permissions......Page 355
6.2.11 Deleting......Page 356
6.3 glob: Filename Pattern Matching......Page 357
6.3.2 Wildcards......Page 358
6.3.3 Single-Character Wildcard......Page 359
6.3.5 Escaping Meta-characters......Page 360
6.4.1 Simple Matching......Page 361
6.4.3 Translating Patterns......Page 363
6.5.1 Test Data......Page 364
6.5.2 Reading Specific Lines......Page 365
6.5.4 Error Handling......Page 366
6.5.5 Reading Python Source Files......Page 367
6.6 tempfile: Temporary File System Objects......Page 368
6.6.1 Temporary Files......Page 369
6.6.3 Spooled Files......Page 371
6.6.5 Predicting Names......Page 373
6.6.6 Temporary File Location......Page 374
6.7.1 Copying Files......Page 375
6.7.2 Copying File Metadata......Page 378
6.7.3 Working with Directory Trees......Page 380
6.7.4 Finding Files......Page 383
6.7.5 Archives......Page 384
6.7.6 File System Space......Page 388
6.8.1 Example Data......Page 389
6.8.2 Comparing Files......Page 391
6.8.3 Comparing Directories......Page 393
6.8.4 Using Differences in a Program......Page 395
6.9.1 Reading......Page 399
6.9.2 Writing......Page 400
6.9.3 Regular Expressions......Page 402
6.10.1 Unicode Primer......Page 403
6.10.2 Working with Files......Page 406
6.10.3 Byte Order......Page 408
6.10.4 Error Handling......Page 410
6.10.5 Encoding Translation......Page 414
6.10.6 Non-Unicode Encodings......Page 415
6.10.7 Incremental Encoding......Page 416
6.10.8 Unicode Data and Network Communication......Page 418
6.10.9 Defining a Custom Encoding......Page 421
6.11.1 In-Memory Streams......Page 428
6.11.2 Wrapping Byte Streams for Text Data......Page 430
Chapter 7 Data Persistence and Exchange......Page 433
7.1.1 Encoding and Decoding Data in Strings......Page 434
7.1.2 Working with Streams......Page 435
7.1.3 Problems Reconstructing Objects......Page 437
7.1.4 Unpicklable Objects......Page 438
7.1.5 Circular References......Page 440
7.2.1 Creating a New Shelf......Page 443
7.2.2 Writeback......Page 444
7.3.1 Database Types......Page 446
7.3.2 Creating a New Database......Page 447
7.3.3 Opening an Existing Database......Page 448
7.3.4 Error Cases......Page 449
7.4.1 Creating a Database......Page 450
7.4.2 Retrieving Data......Page 453
7.4.4 Row Objects......Page 455
7.4.5 Using Variables with Queries......Page 457
7.4.6 Bulk Loading......Page 459
7.4.7 Defining New Column Types......Page 460
7.4.8 Determining Types for Columns......Page 464
7.4.9 Transactions......Page 466
7.4.10 Isolation Levels......Page 469
7.4.11 In-Memory Databases......Page 472
7.4.12 Exporting the Contents of a Database......Page 473
7.4.13 Using Python Functions in SQL......Page 474
7.4.14 Querying with Regular Expressions......Page 477
7.4.15 Custom Aggregation......Page 478
7.4.16 Threading and Connection Sharing......Page 479
7.4.17 Restricting Access to Data......Page 480
7.5.1 Parsing an XML Document......Page 483
7.5.2 Traversing the Parsed Tree......Page 484
7.5.3 Finding Nodes in a Document......Page 485
7.5.4 Parsed Node Attributes......Page 487
7.5.5 Watching Events While Parsing......Page 489
7.5.6 Creating a Custom Tree Builder......Page 491
7.5.7 Parsing Strings......Page 493
7.5.8 Building Documents With Element Nodes......Page 495
7.5.9 Pretty-Printing XML......Page 496
7.5.10 Setting Element Properties......Page 497
7.5.11 Building Trees from Lists of Nodes......Page 499
7.5.12 Serializing XML to a Stream......Page 502
7.6.1 Reading......Page 504
7.6.2 Writing......Page 505
7.6.3 Dialects......Page 507
7.6.4 Using Field Names......Page 512
8.1.1 Working with Data in Memory......Page 515
8.1.2 Incremental Compression and Decompression......Page 517
8.1.3 Mixed Content Streams......Page 518
8.1.4 Checksums......Page 519
8.1.5 Compressing Network Data......Page 520
8.2.1 Writing Compressed Files......Page 524
8.2.2 Reading Compressed Data......Page 527
8.2.3 Working with Streams......Page 528
8.3 bz2: bzip2 Compression......Page 529
8.3.1 One-Shot Operations in Memory......Page 530
8.3.2 Incremental Compression and Decompression......Page 531
8.3.3 Mixed-Content Streams......Page 532
8.3.4 Writing Compressed Files......Page 533
8.3.5 Reading Compressed Files......Page 535
8.3.6 Reading and Writing Unicode Data......Page 536
8.3.7 Compressing Network Data......Page 537
8.4.1 Testing Tar Files......Page 541
8.4.2 Reading Metadata from an Archive......Page 542
8.4.3 Extracting Files from an Archive......Page 544
8.4.5 Using Alternative Archive Member Names......Page 546
8.4.6 Writing Data from Sources Other Than Files......Page 547
8.4.8 Working with Compressed Archives......Page 548
8.5 zipfile: ZIP Archive Access......Page 549
8.5.2 Reading Metadata from an Archive......Page 550
8.5.4 Creating New Archives......Page 552
8.5.5 Using Alternative Archive Member Names......Page 554
8.5.7 Writing with a ZipInfo Instance......Page 555
8.5.8 Appending to Files......Page 556
8.5.9 Python ZIP Archives......Page 557
8.5.10 Limitations......Page 559
9.1.1 Hash Algorithms......Page 561
9.1.3 MD5 Example......Page 562
9.1.5 Creating a Hash by Name......Page 563
9.1.6 Incremental Updates......Page 564
9.2.2 Alternative Digest Types......Page 566
9.2.3 Binary Digests......Page 567
9.2.4 Applications of Message Signatures......Page 568
10.1 subprocess: Spawning Additional Processes......Page 573
10.1.1 Running External Command......Page 574
10.1.2 Working with Pipes Directly......Page 580
10.1.3 Connecting Segments of a Pipe......Page 583
10.1.4 Interacting with Another Command......Page 584
10.1.5 Signaling Between Processes......Page 586
10.2 signal: Asynchronous System Events......Page 591
10.2.1 Receiving Signals......Page 592
10.2.2 Retrieving Registered Handlers......Page 593
10.2.4 Alarms......Page 594
10.2.5 Ignoring Signals......Page 595
10.2.6 Signals and Threads......Page 596
10.3.1 Thread Objects......Page 598
10.3.2 Determining the Current Thread......Page 600
10.3.3 Daemon Versus Non-daemon Threads......Page 602
10.3.4 Enumerating All Threads......Page 605
10.3.5 Subclassing Thread......Page 606
10.3.6 Timer Threads......Page 608
10.3.7 Signaling Between Threads......Page 609
10.3.8 Controlling Access to Resources......Page 610
10.3.9 Synchronizing Threads......Page 616
10.3.10 Limiting Concurrent Access to Resources......Page 619
10.3.11 Thread Specific Data......Page 621
10.4.1 multiprocessing Basics......Page 624
10.4.2 Importable Target Functions......Page 625
10.4.3 Determining the Current Process......Page 626
10.4.4 Daemon Processes......Page 627
10.4.5 Waiting for Processes......Page 629
10.4.6 Terminating Processes......Page 631
10.4.7 Process Exit Status......Page 632
10.4.8 Logging......Page 634
10.4.9 Subclassing Process......Page 635
10.4.10 Passing Messages to Processes......Page 636
10.4.11 Signaling Between Processes......Page 640
10.4.12 Controlling Access to Resources......Page 641
10.4.13 Synchronizing Operations......Page 642
10.4.14 Controlling Concurrent Access to Resources......Page 643
10.4.16 Shared Namespaces......Page 646
10.4.17 Process Pools......Page 649
10.4.18 Implementing MapReduce......Page 651
10.5 asyncio: Asynchronous I/O, Event Loop, and Concurrency Tools......Page 655
10.5.2 Cooperative Multitasking with Coroutines......Page 656
10.5.3 Scheduling Calls to Regular Functions......Page 660
10.5.4 Producing Results Asynchronously......Page 663
10.5.5 Executing Tasks Concurrently......Page 666
10.5.6 Composing Coroutines with Control Structures......Page 670
10.5.7 Synchronization Primitives......Page 675
10.5.8 Asynchronous I/O with Protocol Class Abstractions......Page 682
10.5.9 Asynchronous I/O Using Coroutines and Streams......Page 688
10.5.10 Using SSL......Page 694
10.5.11 Interacting with Domain Name Services......Page 696
10.5.12 Working with Subprocesses......Page 699
10.5.13 Receiving Unix Signals......Page 706
10.5.14 Combining Coroutines with Threads and Processes......Page 708
10.5.15 Debugging with asyncio......Page 711
10.6.1 Using map() with a Basic Thread Pool......Page 715
10.6.2 Scheduling Individual Tasks......Page 716
10.6.3 Waiting for Tasks in Any Order......Page 717
10.6.4 Future Callbacks......Page 718
10.6.5 Canceling Tasks......Page 719
10.6.7 Context Manager......Page 721
10.6.8 Process Pools......Page 722
11.1.1 Addresses......Page 725
11.1.2 Networks......Page 726
11.1.3 Interfaces......Page 730
11.2.1 Addressing, Protocol Families, and Socket Types......Page 731
11.2.2 TCP/IP Client and Server......Page 742
11.2.3 User Datagram Client and Server......Page 749
11.2.4 Unix Domain Sockets......Page 752
11.2.5 Multicast......Page 755
11.2.6 Sending Binary Data......Page 759
11.2.7 Non-blocking Communication and Timeouts......Page 761
11.3.2 Echo Server......Page 762
11.3.3 Echo Client......Page 764
11.3.4 Server and Client Together......Page 765
11.4 select: Wait for I/O Efficiently......Page 766
11.4.1 Using select()......Page 767
11.4.2 Non-blocking I/O with Timeouts......Page 772
11.4.3 Using poll()......Page 775
11.5.1 Server Types......Page 780
11.5.4 Request Handlers......Page 781
11.5.5 Echo Example......Page 782
11.5.6 Threading and Forking......Page 787
12.1 urllib.parse: Split URLs into Components......Page 791
12.1.1 Parsing......Page 792
12.1.2 Unparsing......Page 794
12.1.3 Joining......Page 796
12.1.4 Encoding Query Arguments......Page 797
12.2.1 HTTP GET......Page 799
12.2.2 Encoding Arguments......Page 801
12.2.3 HTTP POST......Page 802
12.2.4 Adding Outgoing Headers......Page 803
12.2.5 Posting Form Data from a Request......Page 804
12.2.6 Uploading Files......Page 805
12.2.7 Creating Custom Protocol Handlers......Page 808
12.3.1 robots.txt......Page 811
12.3.2 Testing Access Permissions......Page 812
12.3.3 Long-Lived Spiders......Page 813
12.4 base64: Encode Binary Data with ASCII......Page 814
12.4.1 Base 64 Encoding......Page 815
12.4.3 URL-Safe Variations......Page 816
12.4.4 Other Encodings......Page 817
12.5.1 HTTP GET......Page 819
12.5.2 HTTP POST......Page 822
12.5.3 Threading and Forking......Page 824
12.5.4 Handling Errors......Page 825
12.5.5 Setting Headers......Page 826
12.5.6 Command-Line Use......Page 827
12.6.1 Creating and Setting a Cookie......Page 828
12.6.2 Morsels......Page 829
12.6.3 Encoded Values......Page 831
12.6.4 Receiving and Parsing Cookie Headers......Page 832
12.6.5 Alternative Output Formats......Page 833
12.7.3 Using a Specific Browser......Page 834
12.8 uuid: Universally Unique Identifiers......Page 835
12.8.1 UUID 1: IEEE 802 MAC Address......Page 836
12.8.2 UUID 3 and 5: Name-Based Values......Page 838
12.8.4 Working with UUID Objects......Page 840
12.9 json: JavaScript Object Notation......Page 841
12.9.1 Encoding and Decoding Simple Data Types......Page 842
12.9.2 Human-Consumable Versus Compact Output......Page 843
12.9.4 Working with Custom Types......Page 845
12.9.5 Encoder and Decoder Classes......Page 848
12.9.7 Mixed Data Streams......Page 851
12.9.8 JSON at the Command Line......Page 853
12.10 xmlrpc.client: Client Library for XML-RPC......Page 854
12.10.1 Connecting to a Server......Page 855
12.10.2 Data Types......Page 857
12.10.3 Passing Objects......Page 860
12.10.4 Binary Data......Page 861
12.10.5 Exception Handling......Page 863
12.10.6 Combining Calls into One Message......Page 864
12.11 xmlrpc.server: An XML-RPC Server......Page 865
12.11.1 A Simple Server......Page 866
12.11.2 Alternate API Names......Page 867
12.11.3 Dotted API Names......Page 868
12.11.4 Arbitrary API Names......Page 869
12.11.5 Exposing Methods of Objects......Page 870
12.11.6 Dispatching Calls......Page 872
12.11.7 Introspection API......Page 875
13.1.1 Sending an Email Message......Page 879
13.1.2 Authentication and Encryption......Page 881
13.1.3 Verifying an Email Address......Page 884
13.2.1 Mail Server Base Class......Page 885
13.2.2 Debugging Server......Page 888
13.2.3 Proxy Server......Page 889
13.3.1 mbox......Page 890
13.3.2 Maildir......Page 893
13.3.3 Message Flags......Page 900
13.4.2 Connecting to a Server......Page 902
13.4.4 Listing Mailboxes......Page 904
13.4.5 Mailbox Status......Page 907
13.4.6 Selecting a Mailbox......Page 909
13.4.8 Search Criteria......Page 910
13.4.9 Fetching Messages......Page 912
13.4.10 Whole Messages......Page 918
13.4.11 Uploading Messages......Page 919
13.4.12 Moving and Copying Messages......Page 921
13.4.13 Deleting Messages......Page 922
Chapter 14 Application Building Blocks......Page 925
14.1.2 Defining Arguments......Page 926
14.1.4 Simple Examples......Page 927
14.1.5 Help Output......Page 935
14.1.6 Parser Organization......Page 939
14.1.7 Advanced Argument Processing......Page 946
14.2.1 Function Arguments......Page 954
14.2.3 Long-Form Options......Page 955
14.2.4 A Complete Example......Page 956
14.2.6 GNU-Style Option Parsing......Page 958
14.3 readline: The GNU readline Library......Page 960
14.3.1 Configuring readline......Page 961
14.3.2 Completing Text......Page 962
14.3.3 Accessing the Completion Buffer......Page 965
14.3.4 Input History......Page 969
14.3.5 Hooks......Page 972
14.4.1 Example......Page 973
14.4.2 Using getpass Without a Terminal......Page 975
14.5.1 Processing Commands......Page 976
14.5.2 Command Arguments......Page 978
14.5.3 Live Help......Page 979
14.5.4 Auto-Completion......Page 980
14.5.5 Overriding Base Class Methods......Page 982
14.5.6 Configuring Cmd Through Attributes......Page 984
14.5.7 Running Shell Commands......Page 985
14.5.8 Alternative Inputs......Page 986
14.5.9 Commands from sys.argv......Page 988
14.6.1 Parsing Quoted Strings......Page 989
14.6.2 Making Safe Strings for Shells......Page 991
14.6.4 Splitting Strings into Tokens......Page 992
14.6.5 Including Other Sources of Tokens......Page 993
14.6.6 Controlling the Parser......Page 994
14.6.7 Error Handling......Page 995
14.6.8 POSIX Versus Non-POSIX Parsing......Page 997
14.7 configparser: Work with Configuration Files......Page 998
14.7.2 Reading Configuration Files......Page 999
14.7.3 Accessing Configuration Settings......Page 1001
14.7.4 Modifying Settings......Page 1008
14.7.6 Option Search Path......Page 1010
14.7.7 Combining Values with Interpolation......Page 1013
14.8.2 Logging in Applications Versus Libraries......Page 1018
14.8.4 Rotating Log Files......Page 1019
14.8.5 Verbosity Levels......Page 1020
14.8.7 The Logging Tree......Page 1022
14.8.8 Integration with the warnings Module......Page 1023
14.9 fileinput: Command-Line Filter Framework......Page 1024
14.9.1 Converting M3U Files to RSS......Page 1025
14.9.2 Progress Metadata......Page 1027
14.9.3 In-Place Filtering......Page 1028
14.10.1 Registering Exit Callbacks......Page 1031
14.10.3 Canceling Callbacks......Page 1032
14.10.4 When Are atexit Callbacks Not Called?......Page 1033
14.10.5 Handling Exceptions......Page 1035
14.11 sched: Timed Event Scheduler......Page 1036
14.11.1 Running Events with a Delay......Page 1037
14.11.2 Overlapping Events......Page 1038
14.11.4 Canceling Events......Page 1039
15.1.1 Translation Workflow Overview......Page 1041
15.1.2 Creating Message Catalogs from Source Code......Page 1042
15.1.3 Finding Message Catalogs at Runtime......Page 1045
15.1.4 Plural Values......Page 1046
15.1.5 Application Versus Module Localization......Page 1049
15.2 locale: Cultural Localization API......Page 1050
15.2.1 Probing the Current Locale......Page 1051
15.2.2 Currency......Page 1056
15.2.3 Formatting Numbers......Page 1057
15.2.4 Parsing Numbers......Page 1059
15.2.5 Dates and Times......Page 1060
Chapter 16 Developer Tools......Page 1061
16.1.1 Plain Text Help......Page 1062
16.1.2 HTML Help......Page 1063
16.2.1 Getting Started......Page 1064
16.2.2 Handling Unpredictable Output......Page 1066
16.2.3 Tracebacks......Page 1070
16.2.4 Working Around Whitespace......Page 1072
16.2.5 Test Locations......Page 1077
16.2.6 External Documentation......Page 1080
16.2.7 Running Tests......Page 1082
16.2.8 Test Context......Page 1086
16.3.2 Running Tests......Page 1089
16.3.3 Test Outcomes......Page 1090
16.3.5 Testing Equality......Page 1092
16.3.6 Almost Equal?......Page 1093
16.3.7 Containers......Page 1094
16.3.8 Testing for Exceptions......Page 1099
16.3.9 Test Fixtures......Page 1100
16.3.10 Repeating Tests with Different Inputs......Page 1103
16.3.11 Skipping Tests......Page 1104
16.3.12 Ignoring Failing Tests......Page 1106
16.4.2 Tracing Execution......Page 1107
16.4.3 Code Coverage......Page 1108
16.4.4 Calling Relationships......Page 1111
16.4.5 Programming Interface......Page 1112
16.4.6 Saving Result Data......Page 1114
16.4.7 Options......Page 1115
16.5 traceback: Exceptions and Stack Traces......Page 1116
16.5.2 Examining the Stack......Page 1117
16.5.3 TracebackException......Page 1119
16.5.4 Low-Level Exception APIs......Page 1120
16.5.5 Low-Level Stack APIs......Page 1124
16.6.1 Standard Traceback Dumps......Page 1127
16.6.2 Enabling Detailed Tracebacks......Page 1128
16.6.3 Local Variables in Tracebacks......Page 1131
16.6.4 Exception Properties......Page 1134
16.6.6 Logging Tracebacks......Page 1136
16.7.1 Starting the Debugger......Page 1139
16.7.2 Controlling the Debugger......Page 1142
16.7.3 Breakpoints......Page 1155
16.7.4 Changing Execution Flow......Page 1167
16.7.5 Customizing the Debugger with Aliases......Page 1174
16.7.6 Saving Configuration Settings......Page 1175
16.8.1 Running the Profiler......Page 1178
16.8.2 Running in a Context......Page 1181
16.8.3 pstats: Saving and Working with Statistics......Page 1182
16.8.4 Limiting Report Contents......Page 1183
16.8.5 Caller/Callee Graphs......Page 1184
16.9.2 Basic Example......Page 1186
16.9.3 Storing Values in a Dictionary......Page 1187
16.9.4 From the Command Line......Page 1190
16.10.1 Running from the Command Line......Page 1191
16.11.1 Compiling One Directory......Page 1193
16.11.2 Ignoring Files......Page 1194
16.11.4 Compiling Individual Files......Page 1195
16.11.5 From the Command Line......Page 1196
16.12 pyclbr: Class Browser......Page 1198
16.12.1 Scanning for Classes......Page 1199
16.12.2 Scanning for Functions......Page 1200
16.13.1 Creating Environments......Page 1201
16.13.2 Contents of a Virtual Environment......Page 1202
16.13.3 Using Virtual Environments......Page 1203
16.14.1 Installing pip......Page 1205
17.1.1 Import Path......Page 1207
17.1.2 User Directories......Page 1209
17.1.3 Path Configuration Files......Page 1210
17.1.4 Customizing Site Configuration......Page 1213
17.1.5 Customizing User Configuration......Page 1214
17.1.6 Disabling the site Module......Page 1215
17.2.1 Interpreter Settings......Page 1216
17.2.2 Runtime Environment......Page 1223
17.2.3 Memory Management and Limits......Page 1225
17.2.4 Exception Handling......Page 1232
17.2.5 Low-Level Thread Support......Page 1235
17.2.6 Modules and Imports......Page 1238
17.2.7 Tracing a Program As It Runs......Page 1259
17.3 os: Portable Access to Operating System–Specific Features......Page 1265
17.3.1 Examining the File System Contents......Page 1266
17.3.2 Managing File System Permissions......Page 1268
17.3.3 Creating and Deleting Directories......Page 1271
17.3.5 Safely Replacing an Existing File......Page 1272
17.3.6 Detecting and Changing the Process Owner......Page 1273
17.3.7 Managing the Process Environment......Page 1275
17.3.8 Managing the Process Working Directory......Page 1276
17.3.9 Running External Commands......Page 1277
17.3.10 Creating Processes with os.fork()......Page 1278
17.3.11 Waiting for Child Processes......Page 1280
17.3.12 Spawning New Processes......Page 1282
17.3.13 Operating System Error Codes......Page 1283
17.4.1 Interpreter......Page 1284
17.4.2 Platform......Page 1285
17.4.3 Operating System and Hardware Information......Page 1286
17.4.4 Executable Architecture......Page 1288
17.5.1 Current Usage......Page 1289
17.5.2 Resource Limits......Page 1290
17.6 gc: Garbage Collector......Page 1292
17.6.1 Tracing References......Page 1293
17.6.2 Forcing Garbage Collection......Page 1296
17.6.3 Finding References to Objects That Cannot Be Collected......Page 1297
17.6.4 Collection Thresholds and Generations......Page 1299
17.6.5 Debugging......Page 1303
17.7.1 Configuration Variables......Page 1308
17.7.2 Installation Paths......Page 1310
17.7.3 Python Version and Platform......Page 1314
18.1 warnings: Non-fatal Alerts......Page 1317
18.1.2 Generating Warnings......Page 1318
18.1.3 Filtering with Patterns......Page 1319
18.1.4 Repeated Warnings......Page 1321
18.1.5 Alternative Message Delivery Functions......Page 1322
18.1.6 Formatting......Page 1323
18.1.7 Stack Level in Warnings......Page 1324
18.2.2 Registering a Concrete Class......Page 1325
18.2.3 Implementation Through Subclassing......Page 1326
18.2.4 Helper Base Class......Page 1327
18.2.5 Incomplete Implementations......Page 1328
18.2.6 Concrete Methods in ABCs......Page 1329
18.2.7 Abstract Properties......Page 1330
18.2.8 Abstract Class and Static Methods......Page 1333
18.3 dis: Python Byte-Code Disassembler......Page 1334
18.3.2 Disassembling Functions......Page 1335
18.3.3 Classes......Page 1338
18.3.4 Source Code......Page 1339
18.3.5 Using Disassembly to Debug......Page 1340
18.3.6 Performance Analysis of Loops......Page 1341
18.3.7 Compiler Optimizations......Page 1347
18.4.1 Example Module......Page 1349
18.4.2 Inspecting Modules......Page 1350
18.4.3 Inspecting Classes......Page 1352
18.4.5 Documentation Strings......Page 1354
18.4.6 Retrieving Source......Page 1356
18.4.7 Method and Function Signatures......Page 1357
18.4.8 Class Hierarchies......Page 1360
18.4.9 Method Resolution Order......Page 1361
18.4.10 The Stack and Frames......Page 1362
18.4.11 Command-Line Interface......Page 1365
19.1.1 Example Package......Page 1367
19.1.2 Module Types......Page 1368
19.1.3 Importing Modules......Page 1369
19.1.4 Loaders......Page 1370
19.2.1 Package Import Paths......Page 1372
19.2.2 Development Versions of Packages......Page 1374
19.2.3 Managing Paths with PKG Files......Page 1376
19.2.4 Nested Packages......Page 1378
19.2.5 Package Data......Page 1379
19.3.1 Example......Page 1382
19.3.3 Accessing Code......Page 1383
19.3.4 Source......Page 1384
19.3.6 Data......Page 1386
A.1 References......Page 1389
A.3 Renamed Modules......Page 1390
A.4.10 popen2......Page 1392
A.5.2 formatter......Page 1393
A.6.3 argparse......Page 1394
A.6.9 comands......Page 1395
A.6.16 gc......Page 1396
A.6.24 locale......Page 1397
A.6.29 os......Page 1398
A.6.32 pickle......Page 1399
A.6.39 socket......Page 1400
A.6.44 sys......Page 1401
A.6.47 unittest......Page 1402
A.6.52 zipimport......Page 1403
B.2 Algorithms......Page 1405
B.5 Data Persistence and Exchange......Page 1406
B.8 The Internet......Page 1407
B.10 Application Building Blocks......Page 1408
B.11 Developer Tools......Page 1409
O......Page 1411
Z......Page 1412
A......Page 1413
B......Page 1415
C......Page 1416
D......Page 1420
E......Page 1423
F......Page 1424
G......Page 1426
H......Page 1427
I......Page 1428
L......Page 1430
M......Page 1431
N......Page 1433
O......Page 1434
P......Page 1436
R......Page 1439
S......Page 1441
T......Page 1445
U......Page 1448
V......Page 1449
X......Page 1450
Z......Page 1451




نظرات کاربران