 Merhabalar Python programlama derslerinin bir önceki dersinde _tell()_ metodunun kullanımı görmüştük. Bu dersimizde _seek()_ metodunu ve _tell()_ metodunun _seek()_ metodu ile kullanımını göreceğiz. ## seek() Metodu _seek()_ metodu, bir dosyanın herhangi bir yerinden okuma yapmamızı sağlar. _tell()_ metodu ile birlikte kullanılır. Genel yapısı aşağıdaki gibidir : > file.seek(byteNumber) Şimdi de uygulamasını görelim. Okuma yapacağımız _bilgi.txt_ dosyasının içeriği aşağıdaki gibidir :  Kod kısmından bahsedelim. Öncelikle şunu belirteyim. _seek()_ metodu bizim dosya imlecini istediğimiz yere götürmemizi sağlar. Sonrasında okuma işlemini önceki derslerimizden bildiğimiz _read()_ metodu ile yaparız :  Örneğimizde dosyamızı _with_ bloğu içerisinde açıyoruz, bu sebeple dosya kapatma işlemi yapmamıza gerek kalmayacaktır. Dosya içerisinde tr karakterler bulunduğundan _open()_ fonksiyonunu çağırırken _encoding_ parametresini "utf-8" olarak belirtmeyi unutmadık. Sonrasında gelen > file.seek(10) kodu ile imlecimizi 10.byte a konumlandırdık. Ancak burada dikkat edilmesi gereken bir nokta var. 10 sayısını sayarken bir den değil dizilerde olduğu gibi sıfırdan başladık. Yani aslında imleç 11. byte'tadır. > content = file.read(12) kodu ile dosyadan 12 karakterlik bir veri okuyup bu değeri _ content_ değişkenine atadık. _read()_ metodu, herhangi bir parametre almazsa dosyanın tamamını okurken içerisine herhangi bir parametre aldığında o sayı değeri kadar okuma yapar. Son olarak da > print(content) kodu ile okuma yaptığımız kısmı ekrana yazdırdık. Çıktımız aşağıdaki gibidir :  Şimdi böyle bir okuma işleminde imlecimizin yerini öğrenmek için _tell()_ metodunu kullanalım. Programımızın yeni hali aşağıdaki gibidir :  _tell()_ metodu 23 değerini döndürdü. Bunun sebebi 10.byte'tan başlayıp 12 karakter okuması yaptığında 23.byte ın başında olmasıdır. Dosya imlecini dosyanın başına almak için de yine _seek()_ metodunu kullanırız :  Şimdilik bu kadar. Umarım faydalı bir çalışma olmuştur. Teşekkürler.  Kaynak belirtilmeyen görseller bana aittir. The pictures without source in the post is belong to me <hr><center><sub>Posted via <a href="https://www.marlians.com/">Marlians.com</a></sub></center>
author | elektroyazilim |
---|---|
permlink | dosya-islemleri-12-python-dersleri-tutorials |
category | zzan |
json_metadata | {"tags":["zzan","palnet","stem","tr","programming","python","marlians"],"image":["https://cdn.steemitimages.com/DQmVqEHkajCZyuMfc1Nn7AfRj9QwYTddNmLcySkpi48PD1S/yeni.jpg","https://cdn.steemitimages.com/DQmRxreQBJihgndjsv2bU92kPL2zCbjHpZbcdqy1Lecg6tx/image.png","https://cdn.steemitimages.com/DQmdkCVDX5h3MwTysEUEAtciPsxTKkUrAvAJV61uAwe2XzM/image.png","https://cdn.steemitimages.com/DQmNt5qjm5zujVi14mwap4d2MHBXfT8Ypd6XYA4RBYCFESc/image.png","https://cdn.steemitimages.com/DQmddP5CFw1wExdto578jKFDAGxvPJ93EGu8vV2dnPJgg31/image.png","https://cdn.steemitimages.com/DQmeW21svnLz7x31NmGk5cnu1uJy4WcfaAKX9HHPySYMKrd/image.png","https://cdn.steemitimages.com/DQmYZw2bhUomeivJwQ8CiLaTzXTbJPLd1PsSGdcoEE1DfKP/yesilayrca.png"],"app":"marlians/0.1","format":"markdown"} |
created | 2019-08-06 06:49:42 |
last_update | 2019-08-06 06:49:42 |
depth | 0 |
children | 6 |
last_payout | 2019-08-13 06:49:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 8.756 HBD |
curator_payout_value | 2.763 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 2,926 |
author_reputation | 73,919,354,200,140 |
root_title | "Dosya İşlemleri # 12 - Python Dersleri (Tutorials)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 89,199,676 |
net_rshares | 34,411,018,745,794 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
alex2016 | 0 | 49,771,866 | 100% | ||
steemyoda | 0 | 4,365,059,832,643 | 31.67% | ||
bukiland | 0 | 326,182,278 | 3.6% | ||
bloggingforbeans | 0 | 11,393,316,533 | 32% | ||
lovejuice | 0 | 184,870,582,187 | 28.57% | ||
joeparys | 0 | 1,062,794,662,681 | 17.36% | ||
faustofraser | 0 | 246,143,908 | 16% | ||
imisstheoldkanye | 0 | 2,330,896,776 | 1% | ||
steinhammer | 0 | 589,432,146 | 20% | ||
abandi | 0 | 702,590,223 | 100% | ||
neokuduk | 0 | 16,344,115,315 | 100% | ||
literaturk | 0 | 3,958,890,838 | 100% | ||
minnowvotes | 0 | 21,351,409,587,680 | 98.39% | ||
sudefteri | 0 | 11,682,237,325 | 100% | ||
rasit | 0 | 532,962,956 | 100% | ||
bid4joy | 0 | 227,460,991,208 | 50% | ||
maveraunnehr | 0 | 534,293,827 | 100% | ||
dailyhouston | 0 | 418,783,217 | 78.71% | ||
brupvoter | 0 | 2,736,082,994,775 | 68.88% | ||
soteyapanbot | 0 | 17,133,850,981 | 20% | ||
oceansbot | 0 | 110,680,994 | 78.71% | ||
thebot | 0 | 860,542,368,518 | 88.93% | ||
oceanwhale | 0 | 1,533,405,559,127 | 78.71% | ||
crabbot | 0 | 546,215,716 | 100% | ||
profitvote | 0 | 1,150,627,744,327 | 86.35% | ||
mozer | 0 | 1,814,979,749 | 30% | ||
tahirozgen | 0 | 83,853,225,518 | 90% | ||
laissez-faire | 0 | 28,863,290 | 100% | ||
kabasakal | 0 | 11,817,895,216 | 30% | ||
mojo4you | 0 | 333,953,423 | 100% | ||
maonx | 0 | 8,968,624,056 | 100% | ||
omeryetim | 0 | 120,472,417 | 30% | ||
etasarim | 0 | 4,188,634,240 | 100% | ||
hdu | 0 | 4,100,408,691 | 2% | ||
nurengizbagirova | 0 | 360,646,565 | 100% | ||
iskenderk | 0 | 14,101,590,327 | 100% | ||
yusufyusuf | 0 | 60,811,819,677 | 100% | ||
cocukgelisimi | 0 | 6,104,148,098 | 100% | ||
elektroyazilim | 0 | 34,836,418,843 | 100% | ||
bro-rando | 0 | 638,229,555,508 | 32% | ||
vxc | 0 | 1,152,340,915 | 50% | ||
bamos | 0 | 1,040,481,216 | 5% |
You got a 50.00% upvote from @bid4joy courtesy of @elektroyazilim!
author | bid4joy |
---|---|
permlink | re-elektroyazilim-dosya-islemleri-12-python-dersleri-tutorials-20190809t080946342z |
category | zzan |
json_metadata | {"app":"postpromoter/2.1.1"} |
created | 2019-08-09 08:09:45 |
last_update | 2019-08-09 08:09:45 |
depth | 1 |
children | 0 |
last_payout | 2019-08-16 08:09:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 67 |
author_reputation | 11,746,524,585,557 |
root_title | "Dosya İşlemleri # 12 - Python Dersleri (Tutorials)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 89,323,617 |
net_rshares | 0 |
You got a 68.88% upvote from @brupvoter courtesy of @elektroyazilim!
author | brupvoter |
---|---|
permlink | re-elektroyazilim-dosya-islemleri-12-python-dersleri-tutorials-20190808t231449380z |
category | zzan |
json_metadata | {"app":"postpromoter/2.1.1"} |
created | 2019-08-08 23:14:48 |
last_update | 2019-08-08 23:14:48 |
depth | 1 |
children | 0 |
last_payout | 2019-08-15 23:14:48 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 69 |
author_reputation | 13,657,314,846,422 |
root_title | "Dosya İşlemleri # 12 - Python Dersleri (Tutorials)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 89,310,718 |
net_rshares | 0 |
You got a 17.36% upvote from @joeparys! Thank you for your support of our services. To continue your support, please follow and delegate Steem power to @joeparys for daily steem and steem dollar payouts!
author | joeparys |
---|---|
permlink | re-elektroyazilim-dosya-islemleri-12-python-dersleri-tutorials-20190809t071902126z |
category | zzan |
json_metadata | {"app":"postpromoter/2.1.1"} |
created | 2019-08-09 07:19:00 |
last_update | 2019-08-09 07:19:00 |
depth | 1 |
children | 0 |
last_payout | 2019-08-16 07:19:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 204 |
author_reputation | 308,134,181,812,267 |
root_title | "Dosya İşlemleri # 12 - Python Dersleri (Tutorials)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 89,322,352 |
net_rshares | 0 |
This post has received a 28.57% upvote from @lovejuice thanks to @elektroyazilim. They love you, so does Aggroed. Please be sure to vote for Witnesses at https://steemit.com/~witnesses.
author | lovejuice |
---|---|
permlink | re-elektroyazilim-dosya-islemleri-12-python-dersleri-tutorials-20190809t180952294z |
category | zzan |
json_metadata | {"app":"postpromoter/1.7.4"} |
created | 2019-08-09 18:09:51 |
last_update | 2019-08-09 18:09:51 |
depth | 1 |
children | 0 |
last_payout | 2019-08-16 18:09:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 185 |
author_reputation | 10,538,740,461,622 |
root_title | "Dosya İşlemleri # 12 - Python Dersleri (Tutorials)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 89,341,728 |
net_rshares | 0 |
You got a 98.39% upvote from @minnowvotes courtesy of @elektroyazilim!
author | minnowvotes |
---|---|
permlink | re-elektroyazilim-dosya-islemleri-12-python-dersleri-tutorials-20190809t124013361z |
category | zzan |
json_metadata | {"app":"postpromoter/2.1.1"} |
created | 2019-08-09 12:40:15 |
last_update | 2019-08-09 12:40:15 |
depth | 1 |
children | 0 |
last_payout | 2019-08-16 12:40:15 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 71 |
author_reputation | -125,291,280,752 |
root_title | "Dosya İşlemleri # 12 - Python Dersleri (Tutorials)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 89,330,452 |
net_rshares | 0 |
The force is with you! You got a 31.67% upvote from @steemyoda courtesy of @elektroyazilim! http://ultraimg.com/images/2018/02/27/n8qb.gif
author | steemyoda |
---|---|
permlink | re-elektroyazilim-dosya-islemleri-12-python-dersleri-tutorials-20190809t192627222z |
category | zzan |
json_metadata | {"app":"postpromoter/2.0.0"} |
created | 2019-08-09 19:26:27 |
last_update | 2019-08-09 19:26:27 |
depth | 1 |
children | 0 |
last_payout | 2019-08-16 19:26:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 140 |
author_reputation | -1,181,563,121,002 |
root_title | "Dosya İşlemleri # 12 - Python Dersleri (Tutorials)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 89,343,899 |
net_rshares | 0 |