Hi Joe,
On 19 November 2011 13:28, Joe Batt wrote:
> I am new to programming and on a very steep curve. I am using Python 3 to
> learn and I am having trouble understanding exactly what pickling is.
> I have written a program that asks for a URL and then writes the source
> code from the URL to
Hi all
I am new to programming and on a very steep curve. I am using Python 3 to
learn and I am having trouble understanding exactly what pickling is. I have
written a program that asks for a URL and then writes the source code from the
URL to a file, then pickles the file I just creat
I have a class 'book' and function for input and display of the class
members
then there are 2 functions for pickling and unpickling class instances from
and to a file.
after unpickling , then displaying it shows only the last class instance
stored in the file!
what can be the possible problems?
__
I use codecs to retain consistent unicode/utf-8 encoding and decoding for
reading/writing to files. Should the codecs be applied when using the
pickle/unpickle function? For example, the standard syntax is:
# pickle object
f = open(object, 'wb')
pickle.dump(object, f, 2)
# unpickle object
f
On Thu, Jun 17, 2010 at 11:11:11AM +0200, Eike Welk wrote:
> I think it is a bug in IPython: I can do this in regular Python, but in
> IPython I get the same error that you get:
>
Thanks a lot. It works in normal python. Thanks again.
With warm regards,
-Payal
--
On Thursday June 17 2010 11:11:11 Eike Welk wrote:
> You should file a bug report in their bug tracker:
> http://github.com/ipython/ipython/issues
I believe tthis is the bug:
http://github.com/ipython/ipython/issues/#issue/29
It seems that objects defined on IPython's top-level can't be pickled.
Hello Payal!
On Thursday June 17 2010 04:48:19 Payal wrote:
> Hi all,
> Can someone please help in this below?
>
> class F(object) :
>...: def __init__(self, amt) : self.amt = amt
>...: def dis(self) : print 'Amount : ', self.amt
>...: def add(self, na) :
>...:
Hi all,
Can someone please help in this below?
class F(object) :
...: def __init__(self, amt) : self.amt = amt
...: def dis(self) : print 'Amount : ', self.amt
...: def add(self, na) :
...: self.amt += na
...: F.dis(self)
pickle.dumps(F)
gives PicklingEr
Just one change - pickler.load() doesn't take an argument - otherwise works
perfectly! Thank-you.
...
6. Make multiple calls to dump() and load() using an explicit pickler, pickling
directly to the file (not tested):
import cPickle as pickle
filename = 'lists.txt'
fw = open(filename, 'wb')
On Mon, 03 Nov 2008 06:42:28 -0500, Kent Johnson wrote:
> On Mon, Nov 3, 2008 at 6:15 AM, Lie Ryan <[EMAIL PROTECTED]> wrote:
>> On Sun, 02 Nov 2008 23:20:47 -0800, Dinesh B Vadhia wrote:
>>
>>> I want to pickle a bunch of lists and write each list separately to a
>>> fileand then read them back.
On Mon, Nov 3, 2008 at 6:15 AM, Lie Ryan <[EMAIL PROTECTED]> wrote:
> On Sun, 02 Nov 2008 23:20:47 -0800, Dinesh B Vadhia wrote:
>
>> I want to pickle a bunch of lists and write each list separately to a
>> fileand then read them back.
> To solve your problem, you have several alternative possibil
On Sun, 02 Nov 2008 23:20:47 -0800, Dinesh B Vadhia wrote:
> I want to pickle a bunch of lists and write each list separately to a
> fileand then read them back. Here is my code with the EOF error:
>
> filename = 'lists.txt'
> fw = open(filename, 'w')
> for l in m:
> n = pickle.dumps(l,
I want to pickle a bunch of lists and write each list separately to a fileand
then read them back. Here is my code with the EOF error:
import cPickle as pickle
m = [[1, 2, 3, 4], [5, 6, 7, 8, 9, 10], [11, 12, 13, 14]]
filename = 'lists.txt'
fw = open(filename, 'w')
for l in m:
n = pick
On Mon, Oct 27, 2008 at 11:40 PM, Lex Flagel <[EMAIL PROTECTED]> wrote:
> I'm using a simple class called Hash, which I picked up from the following
> site:
> http://mail.python.org/pipermail/python-list/2007-August/453716.html
>
> I like using this Hash object for its convenience, but it won't
>
I'm using a simple class called Hash, which I picked up from the following site:
http://mail.python.org/pipermail/python-list/2007-August/453716.html
I like using this Hash object for its convenience, but it won't
unpickle. Is there fix to the code example below (either the pickler
or the Hash ob
John,
Thanks that did help. Like usual, I was making it harder than necessary.
Tom,
I concur! Well put!
On 5/24/05, Tom Cloyd <[EMAIL PROTECTED]> wrote:
> I just want to take a moment to express my deep appreciation for this
> List. As one who is learning Python as amateur, in my spare moments
I just want to take a moment to express my deep appreciation for this
List. As one who is learning Python as amateur, in my spare moments, and
already getting it to do good work for me, these clear, beautifully worked
descriptions of basic aspects of Python are simply an ongoing delight for
Quoting Tom Tucker <[EMAIL PROTECTED]>:
> I am having trouble understanding the c|Pickle modules. What does
> serializing and de-serializing objects mean? I have read the below
> urls and I "think" I understand the process, but I can't visualize the
> beneifts. Can someone kindly explain pickling
I am having trouble understanding the c|Pickle modules. What does
serializing and de-serializing objects mean? I have read the below
urls and I "think" I understand the process, but I can't visualize the
beneifts. Can someone kindly explain pickling in lamens terms?
Thanks,
Tom
http://effbot
Johan,
The problem is in your class V. You have
class V:
a=[]
def add(self, s):
self.a.append(s)
The problem is that 'a' is a *class* variable, not an instance variable. The correct way to define V
is like this:
class V:
def __init__(self):
self.a=[] # Now 'a
20 matches
Mail list logo