forked from python/python-docs-tr
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstdlib.html
More file actions
580 lines (533 loc) · 56.7 KB
/
stdlib.html
File metadata and controls
580 lines (533 loc) · 56.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta property="og:title" content="10. Standart Kütüphanenin Özeti" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://docs.python.org/3/tutorial/stdlib.html" />
<meta property="og:site_name" content="Python documentation" />
<meta property="og:description" content="İşletim Sistemi Arayüzü: os modülü, işletim sistemiyle etkileşim kurmak için düzinelerce fonksiyon sağlar: from os import * yerine import os stilini kullandığınızdan emin olun. Yanlış kullanım olan..." />
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
<meta property="og:image:alt" content="Python documentation" />
<meta name="description" content="İşletim Sistemi Arayüzü: os modülü, işletim sistemiyle etkileşim kurmak için düzinelerce fonksiyon sağlar: from os import * yerine import os stilini kullandığınızdan emin olun. Yanlış kullanım olan..." />
<meta property="og:image:width" content="200" />
<meta property="og:image:height" content="200" />
<meta name="theme-color" content="#3776ab" />
<title>10. Standart Kütüphanenin Özeti — Python 3.11.5 belgelendirmesi</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?digest=b37c26da2f7529d09fe70b41c4b2133fe4931a90" />
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/sphinx_highlight.js"></script>
<script src="../_static/translations.js"></script>
<script src="../_static/sidebar.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Python 3.11.5 belgelendirmesi içinde ara"
href="../_static/opensearch.xml"/>
<link rel="author" title="Bu belgeler hakkında" href="../about.html" />
<link rel="index" title="Dizin" href="../genindex.html" />
<link rel="search" title="Ara" href="../search.html" />
<link rel="copyright" title="Telif Hakkı" href="../copyright.html" />
<link rel="next" title="11. Standart Kütüphanenin Kısa Özeti — Bölüm II" href="stdlib2.html" />
<link rel="prev" title="9. Sınıflar" href="classes.html" />
<link rel="canonical" href="https://docs.python.org/3/tutorial/stdlib.html" />
<style>
@media only screen {
table.full-width-table {
width: 100%;
}
}
</style>
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
<script type="text/javascript" src="../_static/copybutton.js"></script>
<script type="text/javascript" src="../_static/menu.js"></script>
<script type="text/javascript" src="../_static/search-focus.js"></script>
<script type="text/javascript" src="../_static/themetoggle.js"></script>
</head>
<body>
<div class="mobile-nav">
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
<nav class="nav-content" role="navigation">
<label for="menuToggler" class="toggler__label">
<span></span>
</label>
<span class="nav-items-wrapper">
<a href="https://www.python.org/" class="nav-logo">
<img src="../_static/py.svg" alt="Logo"/>
</a>
<span class="version_switcher_placeholder"></span>
<form role="search" class="search" action="../search.html" method="get">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
</svg>
<input placeholder="Hızlı Arama" aria-label="Hızlı Arama" type="search" name="q" />
<input type="submit" value="Git"/>
</form>
</span>
</nav>
<div class="menu-wrapper">
<nav class="menu" role="navigation" aria-label="main navigation">
<div class="language_switcher_placeholder"></div>
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label>
<div>
<h3><a href="../contents.html">İçindekiler</a></h3>
<ul>
<li><a class="reference internal" href="#">10. Standart Kütüphanenin Özeti</a><ul>
<li><a class="reference internal" href="#operating-system-interface">10.1. İşletim Sistemi Arayüzü</a></li>
<li><a class="reference internal" href="#file-wildcards">10.2. Dosya Joker Karakterleri</a></li>
<li><a class="reference internal" href="#command-line-arguments">10.3. Komut Satırı Argümanları</a></li>
<li><a class="reference internal" href="#error-output-redirection-and-program-termination">10.4. Hata Çıktısının Yeniden Yönlendirilmesi ve Programın Sonlandırılması</a></li>
<li><a class="reference internal" href="#string-pattern-matching">10.5. String Örüntü Eşlemesi</a></li>
<li><a class="reference internal" href="#mathematics">10.6. Matematik</a></li>
<li><a class="reference internal" href="#internet-access">10.7. İnternet Erişimi</a></li>
<li><a class="reference internal" href="#dates-and-times">10.8. Tarihler ve Saatler</a></li>
<li><a class="reference internal" href="#data-compression">10.9. Veri Sıkıştırma</a></li>
<li><a class="reference internal" href="#performance-measurement">10.10. Performans Ölçümü</a></li>
<li><a class="reference internal" href="#quality-control">10.11. Kalite Kontrolü</a></li>
<li><a class="reference internal" href="#batteries-included">10.12. Bataryalar Dahildir</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Önceki konu</h4>
<p class="topless"><a href="classes.html"
title="önceki bölüm"><span class="section-number">9. </span>Sınıflar</a></p>
</div>
<div>
<h4>Sonraki konu</h4>
<p class="topless"><a href="stdlib2.html"
title="sonraki bölüm"><span class="section-number">11. </span>Standart Kütüphanenin Kısa Özeti — Bölüm II</a></p>
</div>
<div role="note" aria-label="source link">
<h3>Bu Sayfa</h3>
<ul class="this-page-menu">
<li><a href="../bugs.html">Hata Bildir</a></li>
<li>
<a href="https://github.com/python/cpython/blob/3.11/Doc/tutorial/stdlib.rst"
rel="nofollow">Kaynağı Göster
</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Gezinti</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="Genel Endeks"
accesskey="I">dizin</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Modül Dizini"
>modülleri</a> |</li>
<li class="right" >
<a href="stdlib2.html" title="11. Standart Kütüphanenin Kısa Özeti — Bölüm II"
accesskey="N">sonraki</a> |</li>
<li class="right" >
<a href="classes.html" title="9. Sınıflar"
accesskey="P">önceki</a> |</li>
<li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li class="switchers">
<div class="language_switcher_placeholder"></div>
<div class="version_switcher_placeholder"></div>
</li>
<li>
</li>
<li id="cpython-language-and-version">
<a href="../index.html">3.11.5 Documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Python Öğreticisi</a> »</li>
<li class="nav-item nav-item-this"><a href=""><span class="section-number">10. </span>Standart Kütüphanenin Özeti</a></li>
<li class="right">
<div class="inline-search" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Hızlı Arama" aria-label="Hızlı Arama" type="search" name="q" id="search-box" />
<input type="submit" value="Git" />
</form>
</div>
|
</li>
<li class="right">
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="brief-tour-of-the-standard-library">
<span id="tut-brieftour"></span><h1><span class="section-number">10. </span>Standart Kütüphanenin Özeti<a class="headerlink" href="#brief-tour-of-the-standard-library" title="Permalink to this heading">¶</a></h1>
<section id="operating-system-interface">
<span id="tut-os-interface"></span><h2><span class="section-number">10.1. </span>İşletim Sistemi Arayüzü<a class="headerlink" href="#operating-system-interface" title="Permalink to this heading">¶</a></h2>
<p><a class="reference internal" href="../library/os.html#module-os" title="os: Miscellaneous operating system interfaces."><code class="xref py py-mod docutils literal notranslate"><span class="pre">os</span></code></a> modülü, işletim sistemiyle etkileşim kurmak için düzinelerce fonksiyon sağlar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">os</span>
<span class="gp">>>> </span><span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span> <span class="c1"># Return the current working directory</span>
<span class="go">'C:\\Python311'</span>
<span class="gp">>>> </span><span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="s1">'/server/accesslogs'</span><span class="p">)</span> <span class="c1"># Change current working directory</span>
<span class="gp">>>> </span><span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span><span class="s1">'mkdir today'</span><span class="p">)</span> <span class="c1"># Run the command mkdir in the system shell</span>
<span class="go">0</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">os</span> <span class="pre">import</span> <span class="pre">*</span></code> yerine <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">os</span></code> stilini kullandığınızdan emin olun. Yanlış kullanım olan ilk stili tercih etmek, <a class="reference internal" href="../library/os.html#os.open" title="os.open"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.open()</span></code></a> ‘ın çok daha farklı çalışan gömülü <a class="reference internal" href="../library/functions.html#open" title="open"><code class="xref py py-func docutils literal notranslate"><span class="pre">open()</span></code></a> fonksiyonunu gölgelemesine neden olur.</p>
<p id="index-0">Gömülü <a class="reference internal" href="../library/functions.html#dir" title="dir"><code class="xref py py-func docutils literal notranslate"><span class="pre">dir()</span></code></a> ve <a class="reference internal" href="../library/functions.html#help" title="help"><code class="xref py py-func docutils literal notranslate"><span class="pre">help()</span></code></a> fonksiyonları <a class="reference internal" href="../library/os.html#module-os" title="os: Miscellaneous operating system interfaces."><code class="xref py py-mod docutils literal notranslate"><span class="pre">os</span></code></a> gibi büyük modüllerle çalışma konusunda interaktif yardımcılar olarak kullanışlıdır:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">os</span>
<span class="gp">>>> </span><span class="nb">dir</span><span class="p">(</span><span class="n">os</span><span class="p">)</span>
<span class="go"><returns a list of all module functions></span>
<span class="gp">>>> </span><span class="n">help</span><span class="p">(</span><span class="n">os</span><span class="p">)</span>
<span class="go"><returns an extensive manual page created from the module's docstrings></span>
</pre></div>
</div>
<p>Günlük dosya ve dizin yönetimi görevleri için <a class="reference internal" href="../library/shutil.html#module-shutil" title="shutil: High-level file operations, including copying."><code class="xref py py-mod docutils literal notranslate"><span class="pre">shutil</span></code></a> modülü kullanımı daha kolay olan daha yüksek düzeyli (higher level) bir arayüz sağlar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">shutil</span>
<span class="gp">>>> </span><span class="n">shutil</span><span class="o">.</span><span class="n">copyfile</span><span class="p">(</span><span class="s1">'data.db'</span><span class="p">,</span> <span class="s1">'archive.db'</span><span class="p">)</span>
<span class="go">'archive.db'</span>
<span class="gp">>>> </span><span class="n">shutil</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="s1">'/build/executables'</span><span class="p">,</span> <span class="s1">'installdir'</span><span class="p">)</span>
<span class="go">'installdir'</span>
</pre></div>
</div>
</section>
<section id="file-wildcards">
<span id="tut-file-wildcards"></span><h2><span class="section-number">10.2. </span>Dosya Joker Karakterleri<a class="headerlink" href="#file-wildcards" title="Permalink to this heading">¶</a></h2>
<p><a class="reference internal" href="../library/glob.html#module-glob" title="glob: Unix shell style pathname pattern expansion."><code class="xref py py-mod docutils literal notranslate"><span class="pre">glob</span></code></a> modülü , klasör joker karakter aramalarından dosya listeleri oluşturabilmek için bir fonsiyon sağlar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">glob</span>
<span class="gp">>>> </span><span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s1">'*.py'</span><span class="p">)</span>
<span class="go">['primes.py', 'random.py', 'quote.py']</span>
</pre></div>
</div>
</section>
<section id="command-line-arguments">
<span id="tut-command-line-arguments"></span><h2><span class="section-number">10.3. </span>Komut Satırı Argümanları<a class="headerlink" href="#command-line-arguments" title="Permalink to this heading">¶</a></h2>
<p>Ortak yardımcı programların, çoğunlukla komut satırı argümanlarını işlemeleri gerekir. Bu argümanlar <a class="reference internal" href="../library/sys.html#module-sys" title="sys: Access system-specific parameters and functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys</span></code></a> modülünün <em>argv</em> özelliğinin içinde liste olarak saklanır. Örneğin <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">demo.py</span> <span class="pre">one</span> <span class="pre">two</span> <span class="pre">three</span></code> dosyasını çalıştırdığınız zaman vereceği çıktı:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sys</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span>
<span class="go">['demo.py', 'one', 'two', 'three']</span>
</pre></div>
</div>
<p><a class="reference internal" href="../library/argparse.html#module-argparse" title="argparse: Command-line option and argument parsing library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">argparse</span></code></a> modülü, komut satırı argümanlarını işlemek için daha sofistike bir yöntem sağlar. Aşağıdaki program, bir veya birden fazla dosya adını ve isteğe bağlı görüntülenecek satır sayısını ayıklar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">argparse</span>
<span class="n">parser</span> <span class="o">=</span> <span class="n">argparse</span><span class="o">.</span><span class="n">ArgumentParser</span><span class="p">(</span>
<span class="n">prog</span><span class="o">=</span><span class="s1">'top'</span><span class="p">,</span>
<span class="n">description</span><span class="o">=</span><span class="s1">'Show top lines from each file'</span><span class="p">)</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s1">'filenames'</span><span class="p">,</span> <span class="n">nargs</span><span class="o">=</span><span class="s1">'+'</span><span class="p">)</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s1">'-l'</span><span class="p">,</span> <span class="s1">'--lines'</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
<span class="n">args</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_args</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
</pre></div>
</div>
<p>Komut satırında <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">top.py</span> <span class="pre">--lines=5</span> <span class="pre">alpha.txt</span> <span class="pre">beta.txt</span></code> çalıştırıldığı zaman program, <code class="docutils literal notranslate"><span class="pre">args.lines</span></code> ögesini <code class="docutils literal notranslate"><span class="pre">5</span></code> ve <code class="docutils literal notranslate"><span class="pre">args.filenames</span></code> ögesini <code class="docutils literal notranslate"><span class="pre">['alpha.txt',</span> <span class="pre">'beta.txt']</span></code> olarak ayarlar.</p>
</section>
<section id="error-output-redirection-and-program-termination">
<span id="tut-stderr"></span><h2><span class="section-number">10.4. </span>Hata Çıktısının Yeniden Yönlendirilmesi ve Programın Sonlandırılması<a class="headerlink" href="#error-output-redirection-and-program-termination" title="Permalink to this heading">¶</a></h2>
<p><a class="reference internal" href="../library/sys.html#module-sys" title="sys: Access system-specific parameters and functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys</span></code></a> modülü ayrıca <em>stdin</em>, <em>stdout</em> ve <em>stderr</em> özelliklerine sahiptir. İkincisi, <em>stdout</em> yeniden yönlendirilmiş olsa bile bunları görünür hale getirmek için uyarılar ve hata iletileri yayımlamak için yararlıdır:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">'Warning, log file not found starting a new one</span><span class="se">\n</span><span class="s1">'</span><span class="p">)</span>
<span class="go">Warning, log file not found starting a new one</span>
</pre></div>
</div>
<p>Bir programı sonlandırmak için, en kısa yol olan <code class="docutils literal notranslate"><span class="pre">sys.exit()</span></code> komutunu kullanın.</p>
</section>
<section id="string-pattern-matching">
<span id="tut-string-pattern-matching"></span><h2><span class="section-number">10.5. </span>String Örüntü Eşlemesi<a class="headerlink" href="#string-pattern-matching" title="Permalink to this heading">¶</a></h2>
<p><a class="reference internal" href="../library/re.html#module-re" title="re: Regular expression operations."><code class="xref py py-mod docutils literal notranslate"><span class="pre">re</span></code></a> modülü, gelişmiş string işleme için kurallı ifade araçları sağlar. Karmaşık eşleme ve manipülasyon için, kurallı ifadeler kısa ve optimize edilmiş çözümler sunar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">re</span>
<span class="gp">>>> </span><span class="n">re</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="sa">r</span><span class="s1">'\bf[a-z]*'</span><span class="p">,</span> <span class="s1">'which foot or hand fell fastest'</span><span class="p">)</span>
<span class="go">['foot', 'fell', 'fastest']</span>
<span class="gp">>>> </span><span class="n">re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s1">'(\b[a-z]+) \1'</span><span class="p">,</span> <span class="sa">r</span><span class="s1">'\1'</span><span class="p">,</span> <span class="s1">'cat in the the hat'</span><span class="p">)</span>
<span class="go">'cat in the hat'</span>
</pre></div>
</div>
<p>Basit işlemlerde “string” metodu önerilir çünkü okuması ve hata ayıklaması daha kolaydır:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="s1">'tea for too'</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">'too'</span><span class="p">,</span> <span class="s1">'two'</span><span class="p">)</span>
<span class="go">'tea for two'</span>
</pre></div>
</div>
</section>
<section id="mathematics">
<span id="tut-mathematics"></span><h2><span class="section-number">10.6. </span>Matematik<a class="headerlink" href="#mathematics" title="Permalink to this heading">¶</a></h2>
<p><a class="reference internal" href="../library/math.html#module-math" title="math: Mathematical functions (sin() etc.)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">math</span></code></a> modülünün içindeki C kütüphanesi ondalıklı matematik fonksiyonlarına erişim sağlar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">math</span>
<span class="gp">>>> </span><span class="n">math</span><span class="o">.</span><span class="n">cos</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">0.70710678118654757</span>
<span class="gp">>>> </span><span class="n">math</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="mi">1024</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="go">10.0</span>
</pre></div>
</div>
<p><a class="reference internal" href="../library/random.html#module-random" title="random: Generate pseudo-random numbers with various common distributions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">random</span></code></a> modülü rastgele seçimler yapmak için araçlar sağlar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">random</span>
<span class="gp">>>> </span><span class="n">random</span><span class="o">.</span><span class="n">choice</span><span class="p">([</span><span class="s1">'apple'</span><span class="p">,</span> <span class="s1">'pear'</span><span class="p">,</span> <span class="s1">'banana'</span><span class="p">])</span>
<span class="go">'apple'</span>
<span class="gp">>>> </span><span class="n">random</span><span class="o">.</span><span class="n">sample</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">100</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span> <span class="c1"># sampling without replacement</span>
<span class="go">[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]</span>
<span class="gp">>>> </span><span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span> <span class="c1"># random float</span>
<span class="go">0.17970987693706186</span>
<span class="gp">>>> </span><span class="n">random</span><span class="o">.</span><span class="n">randrange</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span> <span class="c1"># random integer chosen from range(6)</span>
<span class="go">4</span>
</pre></div>
</div>
<p><a class="reference internal" href="../library/statistics.html#module-statistics" title="statistics: Mathematical statistics functions"><code class="xref py py-mod docutils literal notranslate"><span class="pre">statistics</span></code></a> modülü sayı içeren veriler için temel istatistiksel özellikleri hesaplar (ortalama, ortanca, fark, vb.):</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">statistics</span>
<span class="gp">>>> </span><span class="n">data</span> <span class="o">=</span> <span class="p">[</span><span class="mf">2.75</span><span class="p">,</span> <span class="mf">1.75</span><span class="p">,</span> <span class="mf">1.25</span><span class="p">,</span> <span class="mf">0.25</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">1.25</span><span class="p">,</span> <span class="mf">3.5</span><span class="p">]</span>
<span class="gp">>>> </span><span class="n">statistics</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="go">1.6071428571428572</span>
<span class="gp">>>> </span><span class="n">statistics</span><span class="o">.</span><span class="n">median</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="go">1.25</span>
<span class="gp">>>> </span><span class="n">statistics</span><span class="o">.</span><span class="n">variance</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="go">1.3720238095238095</span>
</pre></div>
</div>
<p>SciPy projesi <<a class="reference external" href="https://scipy.org">https://scipy.org</a>> sayısal hesaplamalar için daha fazla modül içerir.</p>
</section>
<section id="internet-access">
<span id="tut-internet-access"></span><h2><span class="section-number">10.7. </span>İnternet Erişimi<a class="headerlink" href="#internet-access" title="Permalink to this heading">¶</a></h2>
<p>İnternete bağlanmak ve internet protokollerini işlemek için bazı modüller var. Bunlardan en basit ikisi; <a class="reference internal" href="../library/urllib.request.html#module-urllib.request" title="urllib.request: Extensible library for opening URLs."><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib.request</span></code></a> URL’lerden veri çekmek, ve <a class="reference internal" href="../library/smtplib.html#module-smtplib" title="smtplib: SMTP protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">smtplib</span></code></a> ise mail göndermek için:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">urllib.request</span> <span class="kn">import</span> <span class="n">urlopen</span>
<span class="gp">>>> </span><span class="k">with</span> <span class="n">urlopen</span><span class="p">(</span><span class="s1">'http://worldtimeapi.org/api/timezone/etc/UTC.txt'</span><span class="p">)</span> <span class="k">as</span> <span class="n">response</span><span class="p">:</span>
<span class="gp">... </span> <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">response</span><span class="p">:</span>
<span class="gp">... </span> <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">decode</span><span class="p">()</span> <span class="c1"># Convert bytes to a str</span>
<span class="gp">... </span> <span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s1">'datetime'</span><span class="p">):</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="n">line</span><span class="o">.</span><span class="n">rstrip</span><span class="p">())</span> <span class="c1"># Remove trailing newline</span>
<span class="gp">...</span>
<span class="go">datetime: 2022-01-01T01:36:47.689215+00:00</span>
<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">smtplib</span>
<span class="gp">>>> </span><span class="n">server</span> <span class="o">=</span> <span class="n">smtplib</span><span class="o">.</span><span class="n">SMTP</span><span class="p">(</span><span class="s1">'localhost'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">server</span><span class="o">.</span><span class="n">sendmail</span><span class="p">(</span><span class="s1">'soothsayer@example.org'</span><span class="p">,</span> <span class="s1">'jcaesar@example.org'</span><span class="p">,</span>
<span class="gp">... </span><span class="sd">"""To: jcaesar@example.org</span>
<span class="gp">... </span><span class="sd">From: soothsayer@example.org</span>
<span class="gp">...</span>
<span class="gp">... </span><span class="sd">Beware the Ides of March.</span>
<span class="gp">... </span><span class="sd">"""</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">server</span><span class="o">.</span><span class="n">quit</span><span class="p">()</span>
</pre></div>
</div>
<p>(İkinci örnek için bir mail sunucusunun localhost’ta çalışması gerektiğini unutmayın.)</p>
</section>
<section id="dates-and-times">
<span id="tut-dates-and-times"></span><h2><span class="section-number">10.8. </span>Tarihler ve Saatler<a class="headerlink" href="#dates-and-times" title="Permalink to this heading">¶</a></h2>
<p><a class="reference internal" href="../library/datetime.html#module-datetime" title="datetime: Basic date and time types."><code class="xref py py-mod docutils literal notranslate"><span class="pre">datetime</span></code></a> modülü, tarihleri ve saatleri hem basit hem de karmaşık şekillerde işlemek için sınıflar sağlar. Tarih ve saat aritmetiği desteklenirken, uygulamanın odak noktası çıktı biçimlendirmesi ve düzenlemesi için verimli üye ayıklamadır. Modül ayrıca saat dilimi farkında olan nesneleri de destekler.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="c1"># dates are easily constructed and formatted</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">date</span>
<span class="gp">>>> </span><span class="n">now</span> <span class="o">=</span> <span class="n">date</span><span class="o">.</span><span class="n">today</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">now</span>
<span class="go">datetime.date(2003, 12, 2)</span>
<span class="gp">>>> </span><span class="n">now</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">"%m-</span><span class="si">%d</span><span class="s2">-%y. </span><span class="si">%d</span><span class="s2"> %b %Y is a %A on the </span><span class="si">%d</span><span class="s2"> day of %B."</span><span class="p">)</span>
<span class="go">'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'</span>
<span class="gp">>>> </span><span class="c1"># dates support calendar arithmetic</span>
<span class="gp">>>> </span><span class="n">birthday</span> <span class="o">=</span> <span class="n">date</span><span class="p">(</span><span class="mi">1964</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">31</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">age</span> <span class="o">=</span> <span class="n">now</span> <span class="o">-</span> <span class="n">birthday</span>
<span class="gp">>>> </span><span class="n">age</span><span class="o">.</span><span class="n">days</span>
<span class="go">14368</span>
</pre></div>
</div>
</section>
<section id="data-compression">
<span id="tut-data-compression"></span><h2><span class="section-number">10.9. </span>Veri Sıkıştırma<a class="headerlink" href="#data-compression" title="Permalink to this heading">¶</a></h2>
<p>Genel veri arşivleme ve sıkıştırma formatları şu modüller tarafından desteklenir: <a class="reference internal" href="../library/zlib.html#module-zlib" title="zlib: Low-level interface to compression and decompression routines compatible with gzip."><code class="xref py py-mod docutils literal notranslate"><span class="pre">zlib</span></code></a>, <a class="reference internal" href="../library/gzip.html#module-gzip" title="gzip: Interfaces for gzip compression and decompression using file objects."><code class="xref py py-mod docutils literal notranslate"><span class="pre">gzip</span></code></a>, <a class="reference internal" href="../library/bz2.html#module-bz2" title="bz2: Interfaces for bzip2 compression and decompression."><code class="xref py py-mod docutils literal notranslate"><span class="pre">bz2</span></code></a>, <a class="reference internal" href="../library/lzma.html#module-lzma" title="lzma: A Python wrapper for the liblzma compression library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">lzma</span></code></a>, <a class="reference internal" href="../library/zipfile.html#module-zipfile" title="zipfile: Read and write ZIP-format archive files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">zipfile</span></code></a> ve <a class="reference internal" href="../library/tarfile.html#module-tarfile" title="tarfile: Read and write tar-format archive files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">tarfile</span></code></a>.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">zlib</span>
<span class="gp">>>> </span><span class="n">s</span> <span class="o">=</span> <span class="sa">b</span><span class="s1">'witch which has which witches wrist watch'</span>
<span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="go">41</span>
<span class="gp">>>> </span><span class="n">t</span> <span class="o">=</span> <span class="n">zlib</span><span class="o">.</span><span class="n">compress</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
<span class="go">37</span>
<span class="gp">>>> </span><span class="n">zlib</span><span class="o">.</span><span class="n">decompress</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
<span class="go">b'witch which has which witches wrist watch'</span>
<span class="gp">>>> </span><span class="n">zlib</span><span class="o">.</span><span class="n">crc32</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="go">226805979</span>
</pre></div>
</div>
</section>
<section id="performance-measurement">
<span id="tut-performance-measurement"></span><h2><span class="section-number">10.10. </span>Performans Ölçümü<a class="headerlink" href="#performance-measurement" title="Permalink to this heading">¶</a></h2>
<p>Bazı Python kullanıcıları, aynı soruna farklı yaklaşımların göreli performansını bilmek konusunda derin bir ilgi geliştirir. Python, bu soruları hemen yanıtlayan bir ölçüm aracı sağlar.</p>
<p>Örneğin, argümanları değiştirmek için geleneksel yaklaşım yerine dizi paketleme ve açma özelliğini kullanmak cazip olabilir. <a class="reference internal" href="../library/timeit.html#module-timeit" title="timeit: Measure the execution time of small code snippets."><code class="xref py py-mod docutils literal notranslate"><span class="pre">timeit</span></code></a> modülü hızla sade bir performans avantajı gösterir:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">timeit</span> <span class="kn">import</span> <span class="n">Timer</span>
<span class="gp">>>> </span><span class="n">Timer</span><span class="p">(</span><span class="s1">'t=a; a=b; b=t'</span><span class="p">,</span> <span class="s1">'a=1; b=2'</span><span class="p">)</span><span class="o">.</span><span class="n">timeit</span><span class="p">()</span>
<span class="go">0.57535828626024577</span>
<span class="gp">>>> </span><span class="n">Timer</span><span class="p">(</span><span class="s1">'a,b = b,a'</span><span class="p">,</span> <span class="s1">'a=1; b=2'</span><span class="p">)</span><span class="o">.</span><span class="n">timeit</span><span class="p">()</span>
<span class="go">0.54962537085770791</span>
</pre></div>
</div>
<p><a class="reference internal" href="../library/timeit.html#module-timeit" title="timeit: Measure the execution time of small code snippets."><code class="xref py py-mod docutils literal notranslate"><span class="pre">timeit</span></code></a> ‘in ince ayrıntı düzeyinin aksine, <a class="reference internal" href="../library/profile.html#module-profile" title="profile: Python source profiler."><code class="xref py py-mod docutils literal notranslate"><span class="pre">profile</span></code></a> ve <a class="reference internal" href="../library/profile.html#module-pstats" title="pstats: Statistics object for use with the profiler."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pstats</span></code></a> modülleri, daha büyük kod bloklarında zaman açısından kritik bölümleri tanımlamak için araçlar sağlar.</p>
</section>
<section id="quality-control">
<span id="tut-quality-control"></span><h2><span class="section-number">10.11. </span>Kalite Kontrolü<a class="headerlink" href="#quality-control" title="Permalink to this heading">¶</a></h2>
<p>Yüksek kalitede yazılımlar geliştirmek için her fonksiyon için testler yazılmalıdır ve bu testler geliştirirken sık sık çalıştırmalıdır.</p>
<p><a class="reference internal" href="../library/doctest.html#module-doctest" title="doctest: Test pieces of code within docstrings."><code class="xref py py-mod docutils literal notranslate"><span class="pre">doctest</span></code></a> modülü, bir modülü taramak ve bir programın docstrings’ine gömülü testleri doğrulamak için bir araç sağlar. Test yapısı, sonuçlarıyla birlikte tipik bir çağrıyı docstring’e kesip yapıştırma kadar basittir. Bu, kullanıcıya bir örnek sunarak dokümantasyonu geliştirir ve doctest modülünün kodun dokümantasyona göre doğru olduğundan emin olmasını sağlar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">average</span><span class="p">(</span><span class="n">values</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""Computes the arithmetic mean of a list of numbers.</span>
<span class="sd"> >>> print(average([20, 30, 70]))</span>
<span class="sd"> 40.0</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">values</span><span class="p">)</span> <span class="o">/</span> <span class="nb">len</span><span class="p">(</span><span class="n">values</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">doctest</span>
<span class="n">doctest</span><span class="o">.</span><span class="n">testmod</span><span class="p">()</span> <span class="c1"># automatically validate the embedded tests</span>
</pre></div>
</div>
<p><a class="reference internal" href="../library/unittest.html#module-unittest" title="unittest: Unit testing framework for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">unittest</span></code></a> modülü, <a class="reference internal" href="../library/doctest.html#module-doctest" title="doctest: Test pieces of code within docstrings."><code class="xref py py-mod docutils literal notranslate"><span class="pre">doctest</span></code></a> modülü gibi çaba istemeyen bir modül değildir ama daha geniş kapsamlı test setlerinin ayrı dosyalarda sağlanmasına imkân verir:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">unittest</span>
<span class="k">class</span> <span class="nc">TestStatisticalFunctions</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">test_average</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">average</span><span class="p">([</span><span class="mi">20</span><span class="p">,</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">70</span><span class="p">]),</span> <span class="mf">40.0</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="n">average</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">7</span><span class="p">]),</span> <span class="mi">1</span><span class="p">),</span> <span class="mf">4.3</span><span class="p">)</span>
<span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="ne">ZeroDivisionError</span><span class="p">):</span>
<span class="n">average</span><span class="p">([])</span>
<span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="ne">TypeError</span><span class="p">):</span>
<span class="n">average</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">70</span><span class="p">)</span>
<span class="n">unittest</span><span class="o">.</span><span class="n">main</span><span class="p">()</span> <span class="c1"># Calling from the command line invokes all tests</span>
</pre></div>
</div>
</section>
<section id="batteries-included">
<span id="tut-batteries-included"></span><h2><span class="section-number">10.12. </span>Bataryalar Dahildir<a class="headerlink" href="#batteries-included" title="Permalink to this heading">¶</a></h2>
<p>Python’un “bataryalar dahil” felsefesi vardır. Bu , büyük paketlerin en iyi şekilde sofistike ve sağlam kapabiliteleriyle görülür. Mesela:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../library/xmlrpc.client.html#module-xmlrpc.client" title="xmlrpc.client: XML-RPC client access."><code class="xref py py-mod docutils literal notranslate"><span class="pre">xmlrpc.client</span></code></a> ve <a class="reference internal" href="../library/xmlrpc.server.html#module-xmlrpc.server" title="xmlrpc.server: Basic XML-RPC server implementations."><code class="xref py py-mod docutils literal notranslate"><span class="pre">xmlrpc.server</span></code></a> modülleri, uzak işlem grubu çağrılarını uygulamayı neredeyse önemsiz bir görev haline getirir. Modül adlarına rağmen, XML’nin doğrudan bilgisine veya işlenmesine gerek yoktur.</p></li>
<li><p><a class="reference internal" href="../library/email.html#module-email" title="email: Package supporting the parsing, manipulating, and generating email messages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code></a> paketi e-mail mesajlarını işlemek için bir kütüphanedir.MIME ve diğer <span class="target" id="index-3"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2822.html"><strong>RFC 2822</strong></a>-tabanlı mesajların dökümanlarını içerir. Mesaj gönderip alan <a class="reference internal" href="../library/smtplib.html#module-smtplib" title="smtplib: SMTP protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">smtplib</span></code></a> ve <a class="reference internal" href="../library/poplib.html#module-poplib" title="poplib: POP3 protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">poplib</span></code></a> ‘in aksine, e-mail paketinin derleme işlemini, kompleks mesaj yapılarının (ekler dahil) decode edilebilmesini sağlayan, internet encode işlemini ve header protokollerini uygulamak için geniş kapsamlı bir toolkit’e sahiptir.</p></li>
<li><p><a class="reference internal" href="../library/json.html#module-json" title="json: Encode and decode the JSON format."><code class="xref py py-mod docutils literal notranslate"><span class="pre">json</span></code></a> paketi, bu popüler veri değişim biçimini ayrıştırmak için sağlam destek sağlar. <a class="reference internal" href="../library/csv.html#module-csv" title="csv: Write and read tabular data to and from delimited files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">csv</span></code></a> modülü, genellikle veritabanları ve elektronik tablolar tarafından desteklenen Virgülle-Ayrılmış Değer biçimindeki dosyaların doğrudan okunmasını ve yazılmasını destekler. XML işleme <a class="reference internal" href="../library/xml.etree.elementtree.html#module-xml.etree.ElementTree" title="xml.etree.ElementTree: Implementation of the ElementTree API."><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.etree.ElementTree</span></code></a>, <a class="reference internal" href="../library/xml.dom.html#module-xml.dom" title="xml.dom: Document Object Model API for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.dom</span></code></a> ve <a class="reference internal" href="../library/xml.sax.html#module-xml.sax" title="xml.sax: Package containing SAX2 base classes and convenience functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.sax</span></code></a> paketleri tarafından desteklenir. Birlikte, bu modüller ve paketler Python uygulamaları ve diğer araçlar arasındaki veri değişimini büyük ölçüde basitleştirir.</p></li>
<li><p><a class="reference internal" href="../library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlite3</span></code></a> modülü , SQLite veritabanı kütüphanesi için bir wrapper’dır. Biraz standart dışı SQL syntax’ları kullanılarak güncellenebilen ve erişilebilen kalıcı bir veritabanı sağlanabilir.</p></li>
<li><p>Uluslararasılaştırma <a class="reference internal" href="../library/gettext.html#module-gettext" title="gettext: Multilingual internationalization services."><code class="xref py py-mod docutils literal notranslate"><span class="pre">gettext</span></code></a>, <a class="reference internal" href="../library/locale.html#module-locale" title="locale: Internationalization services."><code class="xref py py-mod docutils literal notranslate"><span class="pre">locale</span></code></a> ve <a class="reference internal" href="../library/codecs.html#module-codecs" title="codecs: Encode and decode data and streams."><code class="xref py py-mod docutils literal notranslate"><span class="pre">codecs</span></code></a> paketi dahil olmak üzere bir dizi modül tarafından desteklenir.</p></li>
</ul>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div>
<h3><a href="../contents.html">İçindekiler</a></h3>
<ul>
<li><a class="reference internal" href="#">10. Standart Kütüphanenin Özeti</a><ul>
<li><a class="reference internal" href="#operating-system-interface">10.1. İşletim Sistemi Arayüzü</a></li>
<li><a class="reference internal" href="#file-wildcards">10.2. Dosya Joker Karakterleri</a></li>
<li><a class="reference internal" href="#command-line-arguments">10.3. Komut Satırı Argümanları</a></li>
<li><a class="reference internal" href="#error-output-redirection-and-program-termination">10.4. Hata Çıktısının Yeniden Yönlendirilmesi ve Programın Sonlandırılması</a></li>
<li><a class="reference internal" href="#string-pattern-matching">10.5. String Örüntü Eşlemesi</a></li>
<li><a class="reference internal" href="#mathematics">10.6. Matematik</a></li>
<li><a class="reference internal" href="#internet-access">10.7. İnternet Erişimi</a></li>
<li><a class="reference internal" href="#dates-and-times">10.8. Tarihler ve Saatler</a></li>
<li><a class="reference internal" href="#data-compression">10.9. Veri Sıkıştırma</a></li>
<li><a class="reference internal" href="#performance-measurement">10.10. Performans Ölçümü</a></li>
<li><a class="reference internal" href="#quality-control">10.11. Kalite Kontrolü</a></li>
<li><a class="reference internal" href="#batteries-included">10.12. Bataryalar Dahildir</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Önceki konu</h4>
<p class="topless"><a href="classes.html"
title="önceki bölüm"><span class="section-number">9. </span>Sınıflar</a></p>
</div>
<div>
<h4>Sonraki konu</h4>
<p class="topless"><a href="stdlib2.html"
title="sonraki bölüm"><span class="section-number">11. </span>Standart Kütüphanenin Kısa Özeti — Bölüm II</a></p>
</div>
<div role="note" aria-label="source link">
<h3>Bu Sayfa</h3>
<ul class="this-page-menu">
<li><a href="../bugs.html">Hata Bildir</a></li>
<li>
<a href="https://github.com/python/cpython/blob/3.11/Doc/tutorial/stdlib.rst"
rel="nofollow">Kaynağı Göster
</a>
</li>
</ul>
</div>
</div>
<div id="sidebarbutton" title="Yan çubuğu daralt">
<span>«</span>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Gezinti</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="Genel Endeks"
>dizin</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Modül Dizini"
>modülleri</a> |</li>
<li class="right" >
<a href="stdlib2.html" title="11. Standart Kütüphanenin Kısa Özeti — Bölüm II"
>sonraki</a> |</li>
<li class="right" >
<a href="classes.html" title="9. Sınıflar"
>önceki</a> |</li>
<li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li class="switchers">
<div class="language_switcher_placeholder"></div>
<div class="version_switcher_placeholder"></div>
</li>
<li>
</li>
<li id="cpython-language-and-version">
<a href="../index.html">3.11.5 Documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" >Python Öğreticisi</a> »</li>
<li class="nav-item nav-item-this"><a href=""><span class="section-number">10. </span>Standart Kütüphanenin Özeti</a></li>
<li class="right">
<div class="inline-search" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Hızlı Arama" aria-label="Hızlı Arama" type="search" name="q" id="search-box" />
<input type="submit" value="Git" />
</form>
</div>
|
</li>
<li class="right">
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label> |</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Telif Hakkı</a> 2001-2023, Python Software Foundation.
<br />
This page is licensed under the Python Software Foundation License Version 2.
<br />
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
<br />
See <a href="/license.html">History and License</a> for more information.<br />
<br />
The Python Software Foundation is a non-profit corporation.
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
Son güncelleme: Ara 01, 2023.
<a href="/bugs.html">Found a bug</a>?
<br />
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 6.2.1.
</div>
</body>
</html>