forked from python/python-docs-tr
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinputoutput.html
More file actions
665 lines (625 loc) · 73.6 KB
/
inputoutput.html
File metadata and controls
665 lines (625 loc) · 73.6 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
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
<!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="7. Girdi ve Çıktı" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://docs.python.org/3/tutorial/inputoutput.html" />
<meta property="og:site_name" content="Python documentation" />
<meta property="og:description" content="Bir programın çıktısını sunmanın birkaç yolu vardır; veriler okunabilir bir biçimde yazdırılabilir veya ileride kullanılmak üzere bir dosyaya yazılabilir. Bu bölümde bazı olasılıklar tartışılacaktı..." />
<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="Bir programın çıktısını sunmanın birkaç yolu vardır; veriler okunabilir bir biçimde yazdırılabilir veya ileride kullanılmak üzere bir dosyaya yazılabilir. Bu bölümde bazı olasılıklar tartışılacaktı..." />
<meta property="og:image:width" content="200" />
<meta property="og:image:height" content="200" />
<meta name="theme-color" content="#3776ab" />
<title>7. Girdi ve Çıktı — 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="8. Hatalar ve Özel Durumlar" href="errors.html" />
<link rel="prev" title="6. Modüller" href="modules.html" />
<link rel="canonical" href="https://docs.python.org/3/tutorial/inputoutput.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="#">7. Girdi ve Çıktı</a><ul>
<li><a class="reference internal" href="#fancier-output-formatting">7.1. Güzel Çıktı Biçimlendirmesi</a><ul>
<li><a class="reference internal" href="#formatted-string-literals">7.1.1. Biçimlendirilmiş Dize Değişmezleri</a></li>
<li><a class="reference internal" href="#the-string-format-method">7.1.2. String format() Metodu</a></li>
<li><a class="reference internal" href="#manual-string-formatting">7.1.3. Manuel Dize Biçimlendirmesi</a></li>
<li><a class="reference internal" href="#old-string-formatting">7.1.4. Eski dize biçimlendirmesi</a></li>
</ul>
</li>
<li><a class="reference internal" href="#reading-and-writing-files">7.2. Dosyaları Okuma ve Yazma</a><ul>
<li><a class="reference internal" href="#methods-of-file-objects">7.2.1. Dosya Nesnelerinin Metotları</a></li>
<li><a class="reference internal" href="#saving-structured-data-with-json">7.2.2. Yapılandırılmış verileri <code class="xref py py-mod docutils literal notranslate"><span class="pre">json</span></code> ile kaydetme</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Önceki konu</h4>
<p class="topless"><a href="modules.html"
title="önceki bölüm"><span class="section-number">6. </span>Modüller</a></p>
</div>
<div>
<h4>Sonraki konu</h4>
<p class="topless"><a href="errors.html"
title="sonraki bölüm"><span class="section-number">8. </span>Hatalar ve Özel Durumlar</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/inputoutput.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="errors.html" title="8. Hatalar ve Özel Durumlar"
accesskey="N">sonraki</a> |</li>
<li class="right" >
<a href="modules.html" title="6. Modüller"
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">7. </span>Girdi ve Çıktı</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="input-and-output">
<span id="tut-io"></span><h1><span class="section-number">7. </span>Girdi ve Çıktı<a class="headerlink" href="#input-and-output" title="Permalink to this heading">¶</a></h1>
<p>Bir programın çıktısını sunmanın birkaç yolu vardır; veriler okunabilir bir biçimde yazdırılabilir veya ileride kullanılmak üzere bir dosyaya yazılabilir. Bu bölümde bazı olasılıklar tartışılacaktır.</p>
<section id="fancier-output-formatting">
<span id="tut-formatting"></span><h2><span class="section-number">7.1. </span>Güzel Çıktı Biçimlendirmesi<a class="headerlink" href="#fancier-output-formatting" title="Permalink to this heading">¶</a></h2>
<p>So far we’ve encountered two ways of writing values: <em>expression statements</em> and
the <a class="reference internal" href="../library/functions.html#print" title="print"><code class="xref py py-func docutils literal notranslate"><span class="pre">print()</span></code></a> function. (A third way is using the <a class="reference internal" href="../library/io.html#io.TextIOBase.write" title="io.TextIOBase.write"><code class="xref py py-meth docutils literal notranslate"><span class="pre">write()</span></code></a> method
of file objects; the standard output file can be referenced as <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code>.
See the Library Reference for more information on this.)</p>
<p>Genellikle, yalnızca boşlukla ayrılmış değerleri yazdırmaktansa, çıktınızın biçimlendirmesi üzerinde daha fazla denetim istersiniz. Çıktıyı biçimlendirmenin birkaç yolu vardır.</p>
<ul>
<li><p><a class="reference internal" href="#tut-f-strings"><span class="std std-ref">formatted string literals</span></a> kullanmak için, açılış tırnak işaretinden veya üç tırnak işaretinden önce <code class="docutils literal notranslate"><span class="pre">f</span></code> veya <code class="docutils literal notranslate"><span class="pre">F</span></code> ile bir dize başlatın. Bu dizenin içinde, değişkenlere veya hazır bilgi değerlerine başvurabilen <code class="docutils literal notranslate"><span class="pre">{</span></code> ve <code class="docutils literal notranslate"><span class="pre">}</span></code> karakterleri arasında bir Python ifadesi yazabilirsiniz.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">year</span> <span class="o">=</span> <span class="mi">2016</span>
<span class="gp">>>> </span><span class="n">event</span> <span class="o">=</span> <span class="s1">'Referendum'</span>
<span class="gp">>>> </span><span class="sa">f</span><span class="s1">'Results of the </span><span class="si">{</span><span class="n">year</span><span class="si">}</span><span class="s1"> </span><span class="si">{</span><span class="n">event</span><span class="si">}</span><span class="s1">'</span>
<span class="go">'Results of the 2016 Referendum'</span>
</pre></div>
</div>
</li>
<li><p><a class="reference internal" href="../library/stdtypes.html#str.format" title="str.format"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.format()</span></code></a> dize yöntemi daha manuel çaba gerektirir. Bir değişkenin değiştirileceği yeri işaretlemek için <code class="docutils literal notranslate"><span class="pre">{</span></code> ve <code class="docutils literal notranslate"><span class="pre">}</span></code> kullanmaya devam edersiniz ve ayrıntılı biçimlendirme yönergeleri sağlayabilirsiniz, ancak biçimlendirilecek bilgileri de sağlamanız gerekir.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">yes_votes</span> <span class="o">=</span> <span class="mi">42_572_654</span>
<span class="gp">>>> </span><span class="n">no_votes</span> <span class="o">=</span> <span class="mi">43_132_495</span>
<span class="gp">>>> </span><span class="n">percentage</span> <span class="o">=</span> <span class="n">yes_votes</span> <span class="o">/</span> <span class="p">(</span><span class="n">yes_votes</span> <span class="o">+</span> <span class="n">no_votes</span><span class="p">)</span>
<span class="gp">>>> </span><span class="s1">'</span><span class="si">{:-9}</span><span class="s1"> YES votes </span><span class="si">{:2.2%}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">yes_votes</span><span class="p">,</span> <span class="n">percentage</span><span class="p">)</span>
<span class="go">' 42572654 YES votes 49.67%'</span>
</pre></div>
</div>
</li>
<li><p>Son olarak, hayal edebileceğiniz herhangi bir düzen oluşturmak için dize dilimleme ve birleştirme işlemlerini kullanarak tüm dize işlemeyi kendiniz yapabilirsiniz. Dize türü, dizeleri belirli bir sütun genişliğine doldurma için yararlı işlemler gerçekleştiren bazı yöntemlere sahiptir.</p></li>
</ul>
<p>Daha güzel görünen bir çıktıya ihtiyacınız olmadığında, ancak hata ayıklama amacıyla bazı değişkenlerin hızlı bir şekilde görüntülenmesini istediğinizde, herhangi bir değeri <a class="reference internal" href="../library/functions.html#repr" title="repr"><code class="xref py py-func docutils literal notranslate"><span class="pre">repr()</span></code></a> veya <a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-func docutils literal notranslate"><span class="pre">str()</span></code></a> işlevleriyle bir dizeye dönüştürebilirsiniz.</p>
<p><a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-func docutils literal notranslate"><span class="pre">str()</span></code></a> işlevi açıkça okunabilir değerlerin gösterimlerini döndürmek için, <a class="reference internal" href="../library/functions.html#repr" title="repr"><code class="xref py py-func docutils literal notranslate"><span class="pre">repr()</span></code></a> ise yorumlayıcı tarafından okunabilecek gösterimler oluşturmak içindir (veya eş değer bir sözdizimi yoksa <a class="reference internal" href="../library/exceptions.html#SyntaxError" title="SyntaxError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SyntaxError</span></code></a> ‘ı zorlar). İnsan tüketimi için belirli bir temsili olmayan nesneler için <a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-func docutils literal notranslate"><span class="pre">str()</span></code></a>, <a class="reference internal" href="../library/functions.html#repr" title="repr"><code class="xref py py-func docutils literal notranslate"><span class="pre">repr()</span></code></a> ile aynı değeri döndürür. Sayılar veya listeler ve sözlükler benzeri yapılar gibi birçok değer, her iki işlevi de kullanarak aynı gösterime sahiptir. Özellikle dizelerin iki farklı gösterimi vardır.</p>
<p>Bazı örnekler:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">s</span> <span class="o">=</span> <span class="s1">'Hello, world.'</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="go">'Hello, world.'</span>
<span class="gp">>>> </span><span class="nb">repr</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="go">"'Hello, world.'"</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="mi">1</span><span class="o">/</span><span class="mi">7</span><span class="p">)</span>
<span class="go">'0.14285714285714285'</span>
<span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="mi">10</span> <span class="o">*</span> <span class="mf">3.25</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="mi">200</span> <span class="o">*</span> <span class="mi">200</span>
<span class="gp">>>> </span><span class="n">s</span> <span class="o">=</span> <span class="s1">'The value of x is '</span> <span class="o">+</span> <span class="nb">repr</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="s1">', and y is '</span> <span class="o">+</span> <span class="nb">repr</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span> <span class="s1">'...'</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="go">The value of x is 32.5, and y is 40000...</span>
<span class="gp">>>> </span><span class="c1"># The repr() of a string adds string quotes and backslashes:</span>
<span class="gp">... </span><span class="n">hello</span> <span class="o">=</span> <span class="s1">'hello, world</span><span class="se">\n</span><span class="s1">'</span>
<span class="gp">>>> </span><span class="n">hellos</span> <span class="o">=</span> <span class="nb">repr</span><span class="p">(</span><span class="n">hello</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">hellos</span><span class="p">)</span>
<span class="go">'hello, world\n'</span>
<span class="gp">>>> </span><span class="c1"># The argument to repr() may be any Python object:</span>
<span class="gp">... </span><span class="nb">repr</span><span class="p">((</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="p">(</span><span class="s1">'spam'</span><span class="p">,</span> <span class="s1">'eggs'</span><span class="p">)))</span>
<span class="go">"(32.5, 40000, ('spam', 'eggs'))"</span>
</pre></div>
</div>
<p><a class="reference internal" href="../library/string.html#module-string" title="string: Common string operations."><code class="xref py py-mod docutils literal notranslate"><span class="pre">string</span></code></a> modülü bir <a class="reference internal" href="../library/string.html#string.Template" title="string.Template"><code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code></a> sınıfını içerir; bu sınıf, <code class="docutils literal notranslate"><span class="pre">$x</span></code> gibi yer tutucuları kullanarak ve bunları bir sözlükten değerlerle değiştirerek, değerleri dizelerle değiştirmenin başka bir yolunu sunar, ancak biçimlendirme üzerinde çok daha az kontrol sağlar.</p>
<section id="formatted-string-literals">
<span id="tut-f-strings"></span><h3><span class="section-number">7.1.1. </span>Biçimlendirilmiş Dize Değişmezleri<a class="headerlink" href="#formatted-string-literals" title="Permalink to this heading">¶</a></h3>
<p><a class="reference internal" href="../reference/lexical_analysis.html#f-strings"><span class="std std-ref">Formatted string literals</span></a> (kısaltmak için f-string olarak da adlandırılır), dizenin önüne <code class="docutils literal notranslate"><span class="pre">f</span></code> veya <code class="docutils literal notranslate"><span class="pre">F</span></code> yazarak ve ifadeleri <code class="docutils literal notranslate"><span class="pre">{expression}</span></code> olarak yazarak Python ifadelerinin değerini bir dizenin içine eklemenize olanak tanır.</p>
<p>Opsiyonel biçim belirleyicisi ifadeyi izleyebilir. Bu, değerin nasıl biçimlendirileceğini daha fazla denetlemenizi sağlar. Aşağıdaki örnek pi sayısını ondalık sayıdan sonra üç basamağa yuvarlar:</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="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">'The value of pi is approximately </span><span class="si">{</span><span class="n">math</span><span class="o">.</span><span class="n">pi</span><span class="si">:</span><span class="s1">.3f</span><span class="si">}</span><span class="s1">.'</span><span class="p">)</span>
<span class="go">The value of pi is approximately 3.142.</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">':'</span></code> öğesinin ardından bir tamsayı geçmek, bu alanın en az sayıda karakter genişliğinde olmasına neden olur. Bu, sütunların hizaya getirilmesi için yararlıdır.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'Sjoerd'</span><span class="p">:</span> <span class="mi">4127</span><span class="p">,</span> <span class="s1">'Jack'</span><span class="p">:</span> <span class="mi">4098</span><span class="p">,</span> <span class="s1">'Dcab'</span><span class="p">:</span> <span class="mi">7678</span><span class="p">}</span>
<span class="gp">>>> </span><span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">phone</span> <span class="ow">in</span> <span class="n">table</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="n">name</span><span class="si">:</span><span class="s1">10</span><span class="si">}</span><span class="s1"> ==> </span><span class="si">{</span><span class="n">phone</span><span class="si">:</span><span class="s1">10d</span><span class="si">}</span><span class="s1">'</span><span class="p">)</span>
<span class="gp">...</span>
<span class="go">Sjoerd ==> 4127</span>
<span class="go">Jack ==> 4098</span>
<span class="go">Dcab ==> 7678</span>
</pre></div>
</div>
<p>Diğer değiştiriciler, değeri biçimlendirilmeden önce dönüştürmek için kullanılabilir. <code class="docutils literal notranslate"><span class="pre">'!a'</span></code> <a class="reference internal" href="../library/functions.html#ascii" title="ascii"><code class="xref py py-func docutils literal notranslate"><span class="pre">ascii()</span></code></a>, <code class="docutils literal notranslate"><span class="pre">'!s'</span></code> <a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-func docutils literal notranslate"><span class="pre">str()</span></code></a>, ve <code class="docutils literal notranslate"><span class="pre">'!r'</span></code> <a class="reference internal" href="../library/functions.html#repr" title="repr"><code class="xref py py-func docutils literal notranslate"><span class="pre">repr()</span></code></a> uygular:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">animals</span> <span class="o">=</span> <span class="s1">'eels'</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">'My hovercraft is full of </span><span class="si">{</span><span class="n">animals</span><span class="si">}</span><span class="s1">.'</span><span class="p">)</span>
<span class="go">My hovercraft is full of eels.</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">'My hovercraft is full of </span><span class="si">{</span><span class="n">animals</span><span class="si">!r}</span><span class="s1">.'</span><span class="p">)</span>
<span class="go">My hovercraft is full of 'eels'.</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">=</span></code> belirleyicisi, bir ifadeyi ifadenin metnine, eşittir işaretine ve ardından değerlendirilen ifadenin temsiline genişletmek için kullanılabilir:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">bugs</span> <span class="o">=</span> <span class="s1">'roaches'</span>
<span class="gp">>>> </span><span class="n">count</span> <span class="o">=</span> <span class="mi">13</span>
<span class="gp">>>> </span><span class="n">area</span> <span class="o">=</span> <span class="s1">'living room'</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">'Debugging </span><span class="si">{</span><span class="n">bugs</span><span class="si">=}</span><span class="s1"> </span><span class="si">{</span><span class="n">count</span><span class="si">=}</span><span class="s1"> </span><span class="si">{</span><span class="n">area</span><span class="si">=}</span><span class="s1">'</span><span class="p">)</span>
<span class="go">Debugging bugs='roaches' count=13 area='living room'</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">=</span></code> belirtici hakkında daha fazla bilgi için <a class="reference internal" href="../whatsnew/3.8.html#bpo-36817-whatsnew"><span class="std std-ref">kendi kendini belgeleyen ifadeler</span></a> konusuna bakın. Bu biçim belirtimleriyle ilgili bir referans için, <a class="reference internal" href="../library/string.html#formatspec"><span class="std std-ref">Format Specification Mini-Language</span></a> için başvuru kılavuzuna bakın.</p>
</section>
<section id="the-string-format-method">
<span id="tut-string-format"></span><h3><span class="section-number">7.1.2. </span>String format() Metodu<a class="headerlink" href="#the-string-format-method" title="Permalink to this heading">¶</a></h3>
<p><a class="reference internal" href="../library/stdtypes.html#str.format" title="str.format"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.format()</span></code></a> metodunun temel kullanımı şöyle görünür:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'We are the </span><span class="si">{}</span><span class="s1"> who say "</span><span class="si">{}</span><span class="s1">!"'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="s1">'knights'</span><span class="p">,</span> <span class="s1">'Ni'</span><span class="p">))</span>
<span class="go">We are the knights who say "Ni!"</span>
</pre></div>
</div>
<p>İçlerindeki köşeli ayraçlar ve karakterler (format fields olarak adlandırılır) <a class="reference internal" href="../library/stdtypes.html#str.format" title="str.format"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.format()</span></code></a> yöntemine geçirilen nesnelerle değiştirilir. Köşeli ayraçlardaki bir sayı, <a class="reference internal" href="../library/stdtypes.html#str.format" title="str.format"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.format()</span></code></a> yöntemine geçirilen nesnenin konumuna başvurmak için kullanılabilir.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'</span><span class="si">{0}</span><span class="s1"> and </span><span class="si">{1}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="s1">'spam'</span><span class="p">,</span> <span class="s1">'eggs'</span><span class="p">))</span>
<span class="go">spam and eggs</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'</span><span class="si">{1}</span><span class="s1"> and </span><span class="si">{0}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="s1">'spam'</span><span class="p">,</span> <span class="s1">'eggs'</span><span class="p">))</span>
<span class="go">eggs and spam</span>
</pre></div>
</div>
<p>Anahtar sözcük argümanları <a class="reference internal" href="../library/stdtypes.html#str.format" title="str.format"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.format()</span></code></a> yönteminde kullanılıyorsa, değerlerine argümanın adı kullanılarak başvurulmaktadır.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'This </span><span class="si">{food}</span><span class="s1"> is </span><span class="si">{adjective}</span><span class="s1">.'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="gp">... </span> <span class="n">food</span><span class="o">=</span><span class="s1">'spam'</span><span class="p">,</span> <span class="n">adjective</span><span class="o">=</span><span class="s1">'absolutely horrible'</span><span class="p">))</span>
<span class="go">This spam is absolutely horrible.</span>
</pre></div>
</div>
<p>Konumsal ve anahtar sözcük argümanları isteğe bağlı olarak birleştirilebilir:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'The story of </span><span class="si">{0}</span><span class="s1">, </span><span class="si">{1}</span><span class="s1">, and </span><span class="si">{other}</span><span class="s1">.'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="s1">'Bill'</span><span class="p">,</span> <span class="s1">'Manfred'</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">other</span><span class="o">=</span><span class="s1">'Georg'</span><span class="p">))</span>
<span class="go">The story of Bill, Manfred, and Georg.</span>
</pre></div>
</div>
<p>Bölmek istemediğiniz gerçekten uzun biçimli bir dizeniz varsa, konuma göre değil de ada göre biçimlendirilecek değişkenlere başvurursanız iyi olur. Bu, sadece dict’i geçirerek ve tuşlara erişmek için <code class="docutils literal notranslate"><span class="pre">'[]'</span></code> köşeli ayraçları kullanarak yapılabilir.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'Sjoerd'</span><span class="p">:</span> <span class="mi">4127</span><span class="p">,</span> <span class="s1">'Jack'</span><span class="p">:</span> <span class="mi">4098</span><span class="p">,</span> <span class="s1">'Dcab'</span><span class="p">:</span> <span class="mi">8637678</span><span class="p">}</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'Jack: </span><span class="si">{0[Jack]:d}</span><span class="s1">; Sjoerd: </span><span class="si">{0[Sjoerd]:d}</span><span class="s1">; '</span>
<span class="gp">... </span> <span class="s1">'Dcab: </span><span class="si">{0[Dcab]:d}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">table</span><span class="p">))</span>
<span class="go">Jack: 4098; Sjoerd: 4127; Dcab: 8637678</span>
</pre></div>
</div>
<p>Bu, <code class="docutils literal notranslate"><span class="pre">table</span></code> sözlüğünü <code class="docutils literal notranslate"><span class="pre">**</span></code> gösterimiyle anahtar kelime bağımsız değişkenleri olarak ileterek de yapılabilir.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'Sjoerd'</span><span class="p">:</span> <span class="mi">4127</span><span class="p">,</span> <span class="s1">'Jack'</span><span class="p">:</span> <span class="mi">4098</span><span class="p">,</span> <span class="s1">'Dcab'</span><span class="p">:</span> <span class="mi">8637678</span><span class="p">}</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'Jack: </span><span class="si">{Jack:d}</span><span class="s1">; Sjoerd: </span><span class="si">{Sjoerd:d}</span><span class="s1">; Dcab: </span><span class="si">{Dcab:d}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="o">**</span><span class="n">table</span><span class="p">))</span>
<span class="go">Jack: 4098; Sjoerd: 4127; Dcab: 8637678</span>
</pre></div>
</div>
<p>Bu, özellikle tüm yerel değişkenleri içeren bir sözlük döndüren yerleşik işlev <a class="reference internal" href="../library/functions.html#vars" title="vars"><code class="xref py py-func docutils literal notranslate"><span class="pre">vars()</span></code></a> ile birlikte yararlıdır.</p>
<p>Örnek olarak, aşağıdaki satırlar, tamsayıları ve bunların karelerini ve küplerini veren düzenli bir şekilde hizalanmış bir sütun kümesi oluşturur:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">11</span><span class="p">):</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="s1">'</span><span class="si">{0:2d}</span><span class="s1"> </span><span class="si">{1:3d}</span><span class="s1"> </span><span class="si">{2:4d}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">x</span><span class="o">*</span><span class="n">x</span><span class="p">,</span> <span class="n">x</span><span class="o">*</span><span class="n">x</span><span class="o">*</span><span class="n">x</span><span class="p">))</span>
<span class="gp">...</span>
<span class="go"> 1 1 1</span>
<span class="go"> 2 4 8</span>
<span class="go"> 3 9 27</span>
<span class="go"> 4 16 64</span>
<span class="go"> 5 25 125</span>
<span class="go"> 6 36 216</span>
<span class="go"> 7 49 343</span>
<span class="go"> 8 64 512</span>
<span class="go"> 9 81 729</span>
<span class="go">10 100 1000</span>
</pre></div>
</div>
<p><a class="reference internal" href="../library/stdtypes.html#str.format" title="str.format"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.format()</span></code></a> ile dize biçimlendirmeye tam bir genel bakış için bkz. <a class="reference internal" href="../library/string.html#formatstrings"><span class="std std-ref">Format String Syntax</span></a>.</p>
</section>
<section id="manual-string-formatting">
<h3><span class="section-number">7.1.3. </span>Manuel Dize Biçimlendirmesi<a class="headerlink" href="#manual-string-formatting" title="Permalink to this heading">¶</a></h3>
<p>Manuel olarak biçimlendirilmiş aynı kare ve küp tablosu aşağıdadır:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">11</span><span class="p">):</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="nb">repr</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">rjust</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="nb">repr</span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">rjust</span><span class="p">(</span><span class="mi">3</span><span class="p">),</span> <span class="n">end</span><span class="o">=</span><span class="s1">' '</span><span class="p">)</span>
<span class="gp">... </span> <span class="c1"># Note use of 'end' on previous line</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="nb">repr</span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">x</span><span class="o">*</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">rjust</span><span class="p">(</span><span class="mi">4</span><span class="p">))</span>
<span class="gp">...</span>
<span class="go"> 1 1 1</span>
<span class="go"> 2 4 8</span>
<span class="go"> 3 9 27</span>
<span class="go"> 4 16 64</span>
<span class="go"> 5 25 125</span>
<span class="go"> 6 36 216</span>
<span class="go"> 7 49 343</span>
<span class="go"> 8 64 512</span>
<span class="go"> 9 81 729</span>
<span class="go">10 100 1000</span>
</pre></div>
</div>
<p>(Her sütun arasındaki tek boşluğun <a class="reference internal" href="../library/functions.html#print" title="print"><code class="xref py py-func docutils literal notranslate"><span class="pre">print()</span></code></a> çalışma şekliyle ekli olduğunu unutmayın: her zaman argümanları arasına boşluk ekler.)</p>
<p>Dize nesnelerinin <a class="reference internal" href="../library/stdtypes.html#str.rjust" title="str.rjust"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.rjust()</span></code></a> yöntemi, belirli bir genişlikteki bir alandaki dizeyi soldaki boşluklarla doldurmayı haklı hale getirir. Benzer yöntemler vardır <a class="reference internal" href="../library/stdtypes.html#str.ljust" title="str.ljust"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.ljust()</span></code></a> ve <a class="reference internal" href="../library/stdtypes.html#str.center" title="str.center"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.center()</span></code></a>. Bu yöntemler hiçbir şey yazmaz, yalnızca yeni bir dize döndürür. Giriş dizesi çok uzunsa, onu kesmezler, değiştirmeden döndürürler; bu, sütununuzu mahvedecektir, ancak bu genellikle bir değer hakkında yalan söylemek olan alternatiften daha iyidir. (Gerçekten kesilme istiyorsanız, <code class="docutils literal notranslate"><span class="pre">x.ljust(n)[:n]</span></code> gibi her zaman bir dilim işlemi ekleyebilirsiniz.)</p>
<p>Soldaki sayısal bir dizeyi sıfırlarla dolduran başka bir metot vardır: <a class="reference internal" href="../library/stdtypes.html#str.zfill" title="str.zfill"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.zfill()</span></code></a>. Bu metot artı ve eksi işaretlerini anlar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="s1">'12'</span><span class="o">.</span><span class="n">zfill</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="go">'00012'</span>
<span class="gp">>>> </span><span class="s1">'-3.14'</span><span class="o">.</span><span class="n">zfill</span><span class="p">(</span><span class="mi">7</span><span class="p">)</span>
<span class="go">'-003.14'</span>
<span class="gp">>>> </span><span class="s1">'3.14159265359'</span><span class="o">.</span><span class="n">zfill</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="go">'3.14159265359'</span>
</pre></div>
</div>
</section>
<section id="old-string-formatting">
<h3><span class="section-number">7.1.4. </span>Eski dize biçimlendirmesi<a class="headerlink" href="#old-string-formatting" title="Permalink to this heading">¶</a></h3>
<p>% operatör (modulo) dize biçimlendirmesi için de kullanılabilir. <code class="docutils literal notranslate"><span class="pre">'string'</span> <span class="pre">%</span> <span class="pre">values</span></code> göz önüne alındığında, <code class="docutils literal notranslate"><span class="pre">string</span></code> öğesindeki <code class="docutils literal notranslate"><span class="pre">%</span></code> örnekleri sıfır veya daha fazla <code class="docutils literal notranslate"><span class="pre">values</span></code> öğesiyle değiştirilir. Bu işlem genellikle dize enterpolasyonu olarak bilinir. Mesela:</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="nb">print</span><span class="p">(</span><span class="s1">'The value of pi is approximately </span><span class="si">%5.3f</span><span class="s1">.'</span> <span class="o">%</span> <span class="n">math</span><span class="o">.</span><span class="n">pi</span><span class="p">)</span>
<span class="go">The value of pi is approximately 3.142.</span>
</pre></div>
</div>
<p>Daha fazla bilgiyi <a class="reference internal" href="../library/stdtypes.html#old-string-formatting"><span class="std std-ref">printf-style String Formatting</span></a> bölümünde bulabilirsiniz.</p>
</section>
</section>
<section id="reading-and-writing-files">
<span id="tut-files"></span><h2><span class="section-number">7.2. </span>Dosyaları Okuma ve Yazma<a class="headerlink" href="#reading-and-writing-files" title="Permalink to this heading">¶</a></h2>
<p id="index-0"><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> bir <a class="reference internal" href="../glossary.html#term-file-object"><span class="xref std std-term">file object</span></a> döndürür ve en yaygın olarak iki konum argümanı ve bir anahtar sözcük argümanı ile kullanılır: <code class="docutils literal notranslate"><span class="pre">open(filename,</span> <span class="pre">mode,</span> <span class="pre">encoding=None)</span></code></p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s1">'workfile'</span><span class="p">,</span> <span class="s1">'w'</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s2">"utf-8"</span><span class="p">)</span>
</pre></div>
</div>
<p>İlk parametre dosya adını içeren bir dizedir. İkinci parametre dosyanın nasıl kullanılacağını açıklayan birkaç karakter içeren başka bir dizedir. <em>mode</em>, dosya yalnızca okunacağı zaman <code class="docutils literal notranslate"><span class="pre">'r'</span></code>, yalnızca yazmak için <code class="docutils literal notranslate"><span class="pre">'w'</span></code> olabilir (aynı ada sahip varolan bir dosya temizlenir) ve <code class="docutils literal notranslate"><span class="pre">'a'</span></code> dosyayı ekleme için açar; dosyaya yazılan tüm veriler otomatik olarak sonuna eklenir. <code class="docutils literal notranslate"><span class="pre">'r+'</span></code> dosyayı hem okumak hem de yazmak için açar. <em>mode</em> parametresi isteğe bağlıdır; verilmezse <code class="docutils literal notranslate"><span class="pre">'r'</span></code> varsayılacaktır.</p>
<p>Normalde dosyalar <em class="dfn">text mode</em> ‘unda açılır, yani belirli bir <em>kodlamada (encoding)</em> kodlanmış dizeleri dosyadan okur ve dosyaya yazarsınız. <em>kodlama</em> belirtilmezse, varsayılan değer platforma bağlıdır (bakınız <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>). UTF-8 modern de-fakto standart olduğundan, farklı bir kodlama kullanmanız gerekmiyorsa <code class="docutils literal notranslate"><span class="pre">encoding="utf-8"</span></code> kullanmanız önerilir. Moda <code class="docutils literal notranslate"><span class="pre">'b'</span></code> eklemek, dosyayı <em class="dfn">binary</em> modunda açar. İkili mod verileri, <a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> nesneleri olarak okunur ve yazılır. Dosyayı ikili modda açarken <em>kodlama</em> belirtemezsiniz.</p>
<p>Metin modunda, okurken varsayılan değer platforma özgü satır sonlarını (<code class="docutils literal notranslate"><span class="pre">\n</span></code> on Unix, <code class="docutils literal notranslate"><span class="pre">\r\n</span></code> on Windows) yalnızca <code class="docutils literal notranslate"><span class="pre">\n</span></code> olarak dönüştürmektir. Metin modunda yazarken, varsayılan değer <code class="docutils literal notranslate"><span class="pre">\n</span></code> oluşumlarını platforma özgü satır sonlarına geri dönüştürmektir. Dosya verilerinde yapılan bu sahne arkası değişikliği metin dosyaları için iyidir, ancak <code class="file docutils literal notranslate"><span class="pre">JPEG</span></code> veya <code class="file docutils literal notranslate"><span class="pre">EXE</span></code> dosyalarında bunun gibi ikili verileri bozacaktır. Bu tür dosyaları okurken ve yazarken ikili modu kullanmaya çok dikkat edin.</p>
<p>Dosya nesneleriyle uğraşırken <a class="reference internal" href="../reference/compound_stmts.html#with"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">with</span></code></a> anahtar sözcüğünü kullanmak iyi bir uygulamadır. Avantajı, herhangi bir noktada bir hata oluşsa bile, paketi bittikten sonra dosyanın düzgün bir şekilde kapatılmasıdır. <code class="xref std std-keyword docutils literal notranslate"><span class="pre">with</span></code> kullanmak da eş değer <a class="reference internal" href="../reference/compound_stmts.html#try"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">try</span></code></a> -<a class="reference internal" href="../reference/compound_stmts.html#finally"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">finally</span></code></a> blokları yazmaktançok daha kısadır:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s1">'workfile'</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s2">"utf-8"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="gp">... </span> <span class="n">read_data</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="gp">>>> </span><span class="c1"># We can check that the file has been automatically closed.</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">closed</span>
<span class="go">True</span>
</pre></div>
</div>
<p><a class="reference internal" href="../reference/compound_stmts.html#with"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">with</span></code></a> anahtar sözcüğünü kullanmıyorsanız, dosyayı kapatmak ve kullandığı sistem kaynaklarını hemen boşaltmak için <code class="docutils literal notranslate"><span class="pre">f.close()</span></code> metodunu çağırmalısınız.</p>
<div class="admonition warning">
<p class="admonition-title">Uyarı</p>
<p><code class="xref std std-keyword docutils literal notranslate"><span class="pre">with</span></code> anahtar sözcüğünü kullanmadan <code class="docutils literal notranslate"><span class="pre">f.write()</span></code> çağırmak veya <code class="docutils literal notranslate"><span class="pre">f.close()</span></code> çağırmak, program başarıyla çıksa bile <code class="docutils literal notranslate"><span class="pre">f.write()</span></code> parametrelerinin diske tamamen yazılmamasıyla sonuçlanabilir.</p>
</div>
<p>Bir dosya nesnesi kapatıldıktan sonra, bir <a class="reference internal" href="../reference/compound_stmts.html#with"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">with</span></code></a> deyimiyle veya <code class="docutils literal notranslate"><span class="pre">f.close()</span></code> çağırarak dosya nesnesini kullanma girişimleri otomatik olarak başarısız olur.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="gt">Traceback (most recent call last):</span>
File <span class="nb">"<stdin>"</span>, line <span class="m">1</span>, in <span class="n"><module></span>
<span class="gr">ValueError</span>: <span class="n">I/O operation on closed file.</span>
</pre></div>
</div>
<section id="methods-of-file-objects">
<span id="tut-filemethods"></span><h3><span class="section-number">7.2.1. </span>Dosya Nesnelerinin Metotları<a class="headerlink" href="#methods-of-file-objects" title="Permalink to this heading">¶</a></h3>
<p>Bu bölümdeki örneklerin geri kalanı, <code class="docutils literal notranslate"><span class="pre">f</span></code> adlı bir dosya nesnesinin zaten oluşturulduğunu varsayar.</p>
<p>Bir dosyanın içeriğini okumak için, bir miktar veriyi okuyan ve dize (metin modunda) veya bayt nesnesi (ikili modda) olarak döndüren <code class="docutils literal notranslate"><span class="pre">f.read(size)</span></code> öğesini çağırın. <em>size</em> isteğe bağlı bir sayısal parametredir. <em>size</em> boş bırakıldığında veya negatif olduğunda, dosyanın tüm içeriği okunur ve döndürülür; dosya makinenizin belleğinden iki kat daha büyükse bu sizin sorununuzdur. Aksi takdirde, en fazla <em>size</em> karakterleri (metin modunda) veya <em>size</em> bayt (ikili modda) okunur ve döndürülür. Dosyanın sonuna ulaşıldıysa, <code class="docutils literal notranslate"><span class="pre">f.read()</span></code> boş bir dize (<code class="docutils literal notranslate"><span class="pre">''</span></code>) döndürür.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="go">'This is the entire file.\n'</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="go">''</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">f.readline()</span></code> dosyadan tek bir satır okur; dizenin sonunda bir newline karakteri (<code class="docutils literal notranslate"><span class="pre">\n</span></code>) bırakılır ve dosya yalnızca dosya yeni satırda bitmezse dosyanın son satırında atlanır. Bu, dönüş değerini netleştirir; <code class="docutils literal notranslate"><span class="pre">f.readline()</span></code> boş bir dize döndürürse, dosyanın sonuna ulaşılmış demektir, boş bir satır ise yalnızca tek bir yeni satır içeren bir dize olan <code class="docutils literal notranslate"><span class="pre">'\n'</span></code> ile temsil edilir.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">readline</span><span class="p">()</span>
<span class="go">'This is the first line of the file.\n'</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">readline</span><span class="p">()</span>
<span class="go">'Second line of the file\n'</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">readline</span><span class="p">()</span>
<span class="go">''</span>
</pre></div>
</div>
<p>Bir dosyadan satırları okumak için, dosya nesnesinin üzerinde döngü oluşturabilirsiniz. Bu bellek verimliliğine, hızlılığına ve basit koda yol açar:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">f</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="p">,</span> <span class="n">end</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span>
<span class="gp">...</span>
<span class="go">This is the first line of the file.</span>
<span class="go">Second line of the file</span>
</pre></div>
</div>
<p>Listedeki bir dosyanın tüm satırlarını okumak istiyorsanız, <code class="docutils literal notranslate"><span class="pre">list(f)</span></code> veya <code class="docutils literal notranslate"><span class="pre">f.readlines()</span></code> öğelerini de kullanabilirsiniz.</p>
<p><code class="docutils literal notranslate"><span class="pre">f.write(string)</span></code> <em>string</em> içeriğini dosyaya yazar ve yazılan karakter sayısını döndürür.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">'This is a test</span><span class="se">\n</span><span class="s1">'</span><span class="p">)</span>
<span class="go">15</span>
</pre></div>
</div>
<p>Diğer nesne türlerinin yazmadan önce bir dizeye (metin modunda) veya bayt nesnesine (ikili modda) dönüştürülmesi gerekir:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">value</span> <span class="o">=</span> <span class="p">(</span><span class="s1">'the answer'</span><span class="p">,</span> <span class="mi">42</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">s</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="c1"># convert the tuple to string</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="go">18</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">f.tell()</span></code> dosya nesnesinin dosyadaki geçerli konumunu ikili moddayken dosyanın başından itibaren bayt sayısı ve metin modundayken opak bir sayı olarak veren bir tamsayı döndürür.</p>
<p>Dosya nesnesinin konumunu değiştirmek için <code class="docutils literal notranslate"><span class="pre">f.seek(offset,</span> <span class="pre">whence)</span></code> kullanın. Konum, bir referans noktasına <em>offset</em> eklenerek hesaplanır; referans noktası <em>whence</em> parametresi tarafından seçilir. <em>whence</em> değeri dosyanın başından itibaren 0 ölçerken, 1 geçerli dosya konumunu, 2 ise başvuru noktası olarak dosyanın sonunu kullanır. <em>whence</em> atlanabilir ve başvuru noktası için dosyanın başlangıcını kullanarak 0 olarak varsayılabilir.</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s1">'workfile'</span><span class="p">,</span> <span class="s1">'rb+'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s1">'0123456789abcdef'</span><span class="p">)</span>
<span class="go">16</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="c1"># Go to the 6th byte in the file</span>
<span class="go">5</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="go">b'5'</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="o">-</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="c1"># Go to the 3rd byte before the end</span>
<span class="go">13</span>
<span class="gp">>>> </span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="go">b'd'</span>
</pre></div>
</div>
<p>Metin dosyalarında (mod dizesinde <code class="docutils literal notranslate"><span class="pre">b</span></code> olmadan açılanlar), yalnızca dosyanın başına göre aramalara izin verilir (dosyanın sonuna <code class="docutils literal notranslate"><span class="pre">seek(0,</span> <span class="pre">2)</span></code> ile arayan özel durum) ve tek geçerli <em>offset</em> değerleri <code class="docutils literal notranslate"><span class="pre">f.tell()</span></code> veya sıfırdan döndürülen değerlerdir. Başka herhangi bir <em>offset</em> değeri tanımsız davranış üretir.</p>
<p>File objects have some additional methods, such as <a class="reference internal" href="../library/io.html#io.IOBase.isatty" title="io.IOBase.isatty"><code class="xref py py-meth docutils literal notranslate"><span class="pre">isatty()</span></code></a> and
<a class="reference internal" href="../library/io.html#io.IOBase.truncate" title="io.IOBase.truncate"><code class="xref py py-meth docutils literal notranslate"><span class="pre">truncate()</span></code></a> which are less frequently used; consult the Library
Reference for a complete guide to file objects.</p>
</section>
<section id="saving-structured-data-with-json">
<span id="tut-json"></span><h3><span class="section-number">7.2.2. </span>Yapılandırılmış verileri <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> ile kaydetme<a class="headerlink" href="#saving-structured-data-with-json" title="Permalink to this heading">¶</a></h3>
<p id="index-1">Strings can easily be written to and read from a file. Numbers take a bit more
effort, since the <a class="reference internal" href="../library/io.html#io.TextIOBase.read" title="io.TextIOBase.read"><code class="xref py py-meth docutils literal notranslate"><span class="pre">read()</span></code></a> method only returns strings, which will have to
be passed to a function like <a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-func docutils literal notranslate"><span class="pre">int()</span></code></a>, which takes a string like <code class="docutils literal notranslate"><span class="pre">'123'</span></code>
and returns its numeric value 123. When you want to save more complex data
types like nested lists and dictionaries, parsing and serializing by hand
becomes complicated.</p>
<p>Python, kullanıcıların karmaşık veri türlerini dosyalara kaydetmek için sürekli olarak kod yazmasını ve hata ayıklamasını sağlamak yerine, <a class="reference external" href="https://json.org">JSON (JavaScript Object Notation)</a> adlı popüler veri değişim biçimini kullanmanıza olanak tanır. <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> adlı standart modül, Python veri hiyerarşilerini alabilir ve bunları dize temsillerine dönüştürebilir; bu işleme <em class="dfn">serializing</em> adı verilir. Dize gösteriminden verilerin yeniden yapılandırılmasına <em class="dfn">deserializing</em> denir. Serileştirme ve seri durumdan çıkarma arasında, nesneyi temsil eden dizi bir dosyada veya veride saklanmış olabilir veya bir ağ bağlantısı üzerinden uzaktaki bir makineye gönderilmiş olabilir.</p>
<div class="admonition note">
<p class="admonition-title">Not</p>
<p>JSON biçimi, veri alışverişine izin vermek için modern uygulamalar tarafından yaygın olarak kullanılır. Birçok programcı zaten buna aşinadır, bu da onu birlikte çalışabilirlik için iyi bir seçim haline getirir.</p>
</div>
<p><code class="docutils literal notranslate"><span class="pre">x</span></code> nesnesiniz varsa, JSON dize gösterimini basit bir kod satırıyla görüntüleyebilirsiniz:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">json</span>
<span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="s1">'simple'</span><span class="p">,</span> <span class="s1">'list'</span><span class="p">]</span>
<span class="gp">>>> </span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
<span class="go">'[1, "simple", "list"]'</span>
</pre></div>
</div>
<p><a class="reference internal" href="../library/json.html#json.dumps" title="json.dumps"><code class="xref py py-func docutils literal notranslate"><span class="pre">dumps()</span></code></a> işlevinin başka bir çeşidi, <a class="reference internal" href="../library/json.html#json.dump" title="json.dump"><code class="xref py py-func docutils literal notranslate"><span class="pre">dump()</span></code></a> adı verilen nesneyi bir <a class="reference internal" href="../glossary.html#term-text-file"><span class="xref std std-term">text file</span></a> (metin dosyası) olarak seri hale getirmektedir. Yani <code class="docutils literal notranslate"><span class="pre">f</span></code> bir <a class="reference internal" href="../glossary.html#term-text-file"><span class="xref std std-term">text file</span></a> nesnesi yazmak için açılmışsa, bunu yapabiliriz:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">json</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
</pre></div>
</div>
<p>Nesnenin kodunu tekrar çözmek için, <code class="docutils literal notranslate"><span class="pre">f</span></code> okuma için açılmış bir <a class="reference internal" href="../glossary.html#term-binary-file"><span class="xref std std-term">binary file</span></a> veya <a class="reference internal" href="../glossary.html#term-text-file"><span class="xref std std-term">text file</span></a> nesnesiyse:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Not</p>
<p>JSON dosyaları UTF-8’de kodlanmalıdır. Hem okuma hem de yazma için JSON dosyasını <a class="reference internal" href="../glossary.html#term-text-file"><span class="xref std std-term">text file</span></a> olarak açarken <code class="docutils literal notranslate"><span class="pre">encoding="utf-8"</span></code> kullanın.</p>
</div>
<p>Bu basit seri hale getirme tekniği listeleri ve sözlükleri işleyebilir, ancak JSON’da rasgele sınıf örneklerini seri hale getirmek biraz daha fazla çaba gerektirir. <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> modülü için olan örnek bunun bir açıklamasını içerir.</p>
<div class="admonition seealso">
<p class="admonition-title">Ayrıca bakınız</p>
<p><a class="reference internal" href="../library/pickle.html#module-pickle" title="pickle: Convert Python objects to streams of bytes and back."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickle</span></code></a> - pickle modülü</p>
<p><a class="reference internal" href="#tut-json"><span class="std std-ref">JSON</span></a> ifadesinin aksine, <em>pickle</em>, gelişigüzel olarak karmaşık Python nesnelerinin seri hale getirilmesine izin veren bir protokoldür. Bu nedenle, Python’a özgüdür ve diğer dillerde yazılmış uygulamalarla iletişim kurmak için kullanılamaz. Varsayılan olarak da güvensizdir: güvenilmeyen bir kaynaktan gelen pickle verilerinin dizilerinin seri halden çıkarılması, veriler yetenekli bir saldırgan tarafından hazırlanmışsa rasgele kod yürütebilir.</p>
</div>
</section>
</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="#">7. Girdi ve Çıktı</a><ul>
<li><a class="reference internal" href="#fancier-output-formatting">7.1. Güzel Çıktı Biçimlendirmesi</a><ul>
<li><a class="reference internal" href="#formatted-string-literals">7.1.1. Biçimlendirilmiş Dize Değişmezleri</a></li>
<li><a class="reference internal" href="#the-string-format-method">7.1.2. String format() Metodu</a></li>
<li><a class="reference internal" href="#manual-string-formatting">7.1.3. Manuel Dize Biçimlendirmesi</a></li>
<li><a class="reference internal" href="#old-string-formatting">7.1.4. Eski dize biçimlendirmesi</a></li>
</ul>
</li>
<li><a class="reference internal" href="#reading-and-writing-files">7.2. Dosyaları Okuma ve Yazma</a><ul>
<li><a class="reference internal" href="#methods-of-file-objects">7.2.1. Dosya Nesnelerinin Metotları</a></li>
<li><a class="reference internal" href="#saving-structured-data-with-json">7.2.2. Yapılandırılmış verileri <code class="xref py py-mod docutils literal notranslate"><span class="pre">json</span></code> ile kaydetme</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Önceki konu</h4>
<p class="topless"><a href="modules.html"
title="önceki bölüm"><span class="section-number">6. </span>Modüller</a></p>
</div>
<div>
<h4>Sonraki konu</h4>
<p class="topless"><a href="errors.html"
title="sonraki bölüm"><span class="section-number">8. </span>Hatalar ve Özel Durumlar</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/inputoutput.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="errors.html" title="8. Hatalar ve Özel Durumlar"
>sonraki</a> |</li>
<li class="right" >
<a href="modules.html" title="6. Modüller"
>ö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">7. </span>Girdi ve Çıktı</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>