Re: [Tutor] Need help printing a pickled data

2013-06-24 Thread Peter Otten
Matt D wrote: > On 06/24/2013 07:17 PM, Alan Gauld wrote: >> On 24/06/13 23:05, Matt D wrote: >>> I have been unable to find a way to write pickled data to text file. >> >> Probably because pickled data is not plain text. >> You need to use binary mode. However... >> >> >>> def __init__(se

Re: [Tutor] mistaken about splitting expressions over lines

2013-06-24 Thread Dave Angel
On 06/24/2013 09:48 PM, Jim Mooney wrote: For some reason I took the impression that you could split expressions over lines. However, this works: word = 'spam' new_word = word + 'eggs' print(word) But this is a syntax error: word = 'spam' new_word = word + 'eggs' print(word) That's easy to

[Tutor] mistaken about splitting expressions over lines

2013-06-24 Thread Jim Mooney
For some reason I took the impression that you could split expressions over lines. However, this works: word = 'spam' new_word = word + 'eggs' print(word) But this is a syntax error: word = 'spam' new_word = word + 'eggs' print(word) That's easy to avoid, but what if you're adding five or six

Re: [Tutor] Need help printing a pickled data

2013-06-24 Thread Matt D
On 06/24/2013 07:17 PM, Alan Gauld wrote: > On 24/06/13 23:05, Matt D wrote: >> I have been unable to find a way to write pickled data to text file. > > Probably because pickled data is not plain text. > You need to use binary mode. However... > > >> def __init__(self, data): >> wx

Re: [Tutor] Need help printing a pickled data

2013-06-24 Thread Marc Tompkins
On Mon, Jun 24, 2013 at 3:48 PM, Matt D wrote: > > def __init__(self, data): > > wx.PyEvent.__init__(self) > > # this line *binds* this class to a certain type of event, > > wxDATA_EVENT > > self.SetEventType (wxDATA_EVENT) > > # and this is the actual data >

Re: [Tutor] Need help printing a pickled data

2013-06-24 Thread Alan Gauld
On 24/06/13 23:05, Matt D wrote: I have been unable to find a way to write pickled data to text file. Probably because pickled data is not plain text. You need to use binary mode. However... def __init__(self, data): wx.PyEvent.__init__(self) self.SetEventType (wxDATA_

Re: [Tutor] Need help printing a pickled data

2013-06-24 Thread Matt D
On 06/24/2013 06:05 PM, Matt D wrote: > I have been unable to find a way to write pickled data to text file. > My last attempt was to add the last two lines: > > # the dataevent class -- stores the data that gets transmitted when the > event occurs. > #it is the data in text fields, stored in sel

Re: [Tutor] Need help printing a pickled data

2013-06-24 Thread Steven D'Aprano
On Mon, Jun 24, 2013 at 06:05:37PM -0400, Matt D wrote: > I have been unable to find a way to write pickled data to text file. Normally you write pickled data to a file like this: import pickle data = {'something': 'goes', 'here': 42} with open("/path/to/file/name.pickle", "rb") as f: pickl

Re: [Tutor] Need help appending data to a logfile

2013-06-24 Thread Matt D
On 06/24/2013 05:57 PM, Dave Angel wrote: > On 06/24/2013 05:39 PM, Matt D wrote: >> >>> But what he's doing has nothing to do with logging. He's just using >>> that word. >>> >>> >> Right, I'm not doing a debugging thing. Just trying to create a log of >> data that has been passed into the displ

[Tutor] Need help printing a pickled data

2013-06-24 Thread Matt D
I have been unable to find a way to write pickled data to text file. My last attempt was to add the last two lines: # the dataevent class -- stores the data that gets transmitted when the event occurs. #it is the data in text fields, stored in self.data as a dictionary, which is basically a c++ m

Re: [Tutor] Need help appending data to a logfile

2013-06-24 Thread Dave Angel
On 06/24/2013 05:39 PM, Matt D wrote: But what he's doing has nothing to do with logging. He's just using that word. Right, I'm not doing a debugging thing. Just trying to create a log of data that has been passed into the display of this program. Since I started trying to use the array t

Re: [Tutor] "farkadoodle" or: unique global names, was Re: Data persistence problem

2013-06-24 Thread Jim Mooney
eryksun > > Oh my. I don't think using the numbers spelled out makes it any > better. I couldn't keep dict_thirty_four vs dict_sixty_five straight > in my head to save my life. It was just for fun. But by coincidence I was trolling the web and some guy wanted to know if Python could change a numb

Re: [Tutor] Help (Antonio Zagheni)

2013-06-24 Thread Alan Gauld
On 24/06/13 14:34, Antonio Zagheni wrote: But I am trying to paste the clipboard content to MS word and when I do it MS word becomes not responding. OK, so the question is not how to manipulate the clipboard but how to manipulate MS Word. There are multiple ways to approach that. What techno

Re: [Tutor] Help (Antonio Zagheni)

2013-06-24 Thread Peter Otten
Antonio Zagheni wrote: >> I am a begginer in Pythonu >> I did a function that returns a string and I want to copy this to the >> clipboard. I have tried a lot of suggestions found at Google but nothing >> works properly. Is there an easy way to do that? >> I am using Python 2.7 and Windows 7. > >

Re: [Tutor] Function Return Values (or References)

2013-06-24 Thread Steven D'Aprano
On 24/06/13 18:12, John Steedman wrote: Hi Tutors, I'm confused by the following possible contradiction. Would someone please explain or point me to the right docs. [snip confusion about parameter passing and Python's object model] By FACT 1 x should be a reference parameter...? By Fact 2 x

Re: [Tutor] Help (Antonio Zagheni)

2013-06-24 Thread Antonio Zagheni
Hello eryksun, Thanks for your help... But I am trying to paste the clipboard content to MS word and when I do it MS word becomes not responding. So, if you can help... Thanks a lot again, Antonio ZAgheni. Message: 3 Date: Sun, 23 Jun 2013 18:18:11 -0400 From: eryksun To: Antonio Zagheni

Re: [Tutor] Function Return Values (or References)

2013-06-24 Thread John Steedman
Thanks for all these clear and knowledgeable answers. I'm much clearer on this now and will read up a bit more around these subjects. John On Mon, Jun 24, 2013 at 10:59 AM, Peter Otten <__pete...@web.de> wrote: > John Steedman wrote: > > > Hi Tutors, > > > > I'm confused by the following possi

Re: [Tutor] Function Return Values (or References)

2013-06-24 Thread Peter Otten
John Steedman wrote: > Hi Tutors, > > I'm confused by the following possible contradiction. Would someone please > explain or point me to the right docs. > > FACT 1 > > "Variables in python hold references to objects." > http://en.wikipedia.org/wiki/Python_syntax_and_semantics > > FACT 2 > >>

Re: [Tutor] Function Return Values (or References)

2013-06-24 Thread Dave Angel
On 06/24/2013 04:12 AM, John Steedman wrote: Hi Tutors, I'm confused by the following possible contradiction. Would someone please explain or point me to the right docs. FACT 1 "Variables in python hold references to objects." http://en.wikipedia.org/wiki/Python_syntax_and_semantics FACT 2

Re: [Tutor] "farkadoodle" or: unique global names, was Re: Data persistence problem

2013-06-24 Thread eryksun
On Sun, Jun 23, 2013 at 10:38 PM, Jim Mooney wrote: > What about class variables instead of globals?, I put this in the my > lazy typer module, maker.py, which works fine to persist the numbers > between function calls so I can increment them: > > class count: > dict = list = set = tuple = 0 >

[Tutor] Function Return Values (or References)

2013-06-24 Thread John Steedman
Hi Tutors, I'm confused by the following possible contradiction. Would someone please explain or point me to the right docs. FACT 1 "Variables in python hold references to objects." http://en.wikipedia.org/wiki/Python_syntax_and_semantics FACT 2 >>>def Increment ( x ) : >>>// return x + 1