Summary
Keywords
Full Transcript
1) import shelve 2) file = shelve.open(filename) -- abre ou cria um novo db 3) file[key] = value -- guarda um valor na chave 4) value = file[key] -- recebe valor da chave 5) count = len(file) -- número de chaves 6) index = file.keys() -- coloca os valores das chaves numa lista 7) found = key in file 8) del file[key] 9) for key in file 10) file.close() 11) file[key] = list 12) file[key].append(element) -- list permanece nao modificada 13) temp = file[key] - temp.append(element) - file[key] = temp 14) file = shelve.open(filename, writeback = True) permite que os objetos sejam modificaveis pois todos estão armazenados temporariamente na memória, mas torna o programa mais lento Bibliografia Sites: http://docs.python.org/3.4/library/shelve.html pymotw.com/2/shelve/ python.about.com/od/pythonstandardlibrary/a/shelve_intro.htm Livros: Beginning python from novice to professional - Cap. 10, The Standard Library: A Few Favorites, shelve Aprendendo Python - 848 a 853 Programming Python - 1316 a 1323 Dropbox: https://www.dropbox.com/sh/t0lvoxb2fxfhctx/AABIYnYyvqPby6oq0NkQWpRaa
