Created
October 8, 2017 05:24
-
-
Save kkoyun/71ccb37cc7cd4bf1c2722a1876c3a807 to your computer and use it in GitHub Desktop.
Shelve modülüyle liste saklanması / Storage of lists via shelve module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import shelve | |
# "shelf" dosyalarında her listenin bir ismi olmak zorunda | |
# Bu modül kullanılarak bir shelf dosyasındafarklı isimlerle birden çok | |
# liste saklanabilir. | |
# Every list in a shelf file is required to have a name | |
# More than one list can be stored in a shelf file using | |
# this module | |
# liste ve içinde tutulacağı shelf tipi dosyanın ilk yaratılışı | |
# first time creation of the list and the shelf file for storage | |
abcShelf = shelve.open('numaralar') # dosya adı / file name "numaralar" | |
abcShelf['birinci'] = [1, 2, 3, 4, 5] # liste adı / list name "birinci" | |
abcShelf.close() | |
# 'birinci' listesinin güncellenmesi | |
# updating of the list "birinci" | |
tekrar = shelve.open('numaralar') | |
tekrar['birinci'] = tekrar['birinci']+ [6, 7, 8, 9] | |
tekrar.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment