Skip to content

Instantly share code, notes, and snippets.

@kkoyun
Created October 8, 2017 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkoyun/71ccb37cc7cd4bf1c2722a1876c3a807 to your computer and use it in GitHub Desktop.
Save kkoyun/71ccb37cc7cd4bf1c2722a1876c3a807 to your computer and use it in GitHub Desktop.
Shelve modülüyle liste saklanması / Storage of lists via shelve module
#!/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