“Python Python” Respostas de código

salvar coisas em pythle python

import pickle

a = {'hello': 'world'}

with open('filename.pickle', 'wb') as handle:
    pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)

with open('filename.pickle', 'rb') as handle:
    b = pickle.load(handle)

print a == b
TheProgrammer

Pecar um dicionário

import pickle #credits to stack overflow user= blender

a = {'hello': 'world'}

with open('filename.pkl', 'wb') as handle:
    pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)

with open('filename.pkl', 'rb') as handle:
    b = pickle.load(handle)

print (a == b)
Shiny Snail

Crie Python Python

import pickle
file_name='my_file.pkl'
f = open(file_name,'wb')
pickle.dump(my_data,f)
f.close()
Tremendous Enceladus

despejo de picles

import pickle
with open('Fruits.obj', 'wb') as fp:
	pickle.dump(banana, fp)
Blushing Booby

salvar em picles

import pickle

pickle.dump( favorite_color, open( "save.p", "wb" ) )
favorite_color = pickle.load( open( "save.p", "rb" ) )
Erwin Smith

Python Python

import pickle

a = {'hi': 'everybody'}

with open('filename.pickle', 'wb') as f:
    pickle.dump(a, f, protocol=pickle.HIGHEST_PROTOCOL)

with open('filename.pickle', 'rb') as f:
    b = pickle.load(f)
Tirbo06

Respostas semelhantes a “Python Python”

Perguntas semelhantes a “Python Python”

Mais respostas relacionadas para “Python Python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código