Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-16 Thread Frederic Rentsch
On Sat, 2012-07-14 at 20:10 -0700, rantingrickjohn...@gmail.com wrote: On Thursday, July 12, 2012 1:53:54 PM UTC-5, Frederic Rentsch wrote: The hit list is a table of investment titles (stock, funds, bonds) that displays upon entry of a search pattern into a respective template. The table

Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-13 Thread Frederic Rentsch
On Tue, 2012-07-10 at 15:11 -0700, Rick Johnson wrote: I've tried to condense your code using the very limited info you have provided. I have removed unnecessarily configuring of widgets and exaggerated the widget borders to make debugging easier. Read below for QA. ## START CONDENSED CODE

Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-13 Thread Frederic Rentsch
On Fri, 2012-07-13 at 09:26 +0200, Peter Otten wrote: Frederic Rentsch wrote: I'm sorry I can't post an intelligible piece that does NOT work. I obviously can't post the whole thing. How about a pastebin then? Or even bitbucket/github as you need to track changes anyway? It is way

Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-11 Thread Frederic Rentsch
On Tue, 2012-07-10 at 18:06 -0700, Rick Johnson wrote: Also: Q3: Why are you explicitly setting the name of your subFrame widgets instead of allowing Tkinter to assign a unique name?...AND are you aware of the conflicts that can arise from such changes[1]? I find custom-named widgets

Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-10 Thread Frederic Rentsch
On Mon, 2012-07-09 at 10:49 -0700, Rick Johnson wrote: On Jul 9, 12:58 am, Terry Reedy tjre...@udel.edu wrote: When posting problem code, you should post a minimal, self-contained example that people can try on other systems and versions. Can you create the problem with one record, which

Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-09 Thread Frederic Rentsch
On Mon, 2012-07-09 at 01:58 -0400, Terry Reedy wrote: On 7/8/2012 5:19 PM, Frederic Rentsch wrote: Hi widget wizards, The manual describes the event attribute widget as The widget which generated this event. This is a valid Tkinter widget instance, not a name. This attribute is set

Re: Tkinter.event.widget: handler gets name instead of widget.

2012-07-09 Thread Frederic Rentsch
On Mon, 2012-07-09 at 10:49 -0700, Rick Johnson wrote: On Jul 9, 12:58 am, Terry Reedy tjre...@udel.edu wrote: When posting problem code, you should post a minimal, self-contained example that people can try on other systems and versions. Can you create the problem with one record, which

Tkinter.event.widget: handler gets name instead of widget.

2012-07-08 Thread Frederic Rentsch
Hi widget wizards, The manual describes the event attribute widget as The widget which generated this event. This is a valid Tkinter widget instance, not a name. This attribute is set for all events. Ans so it is--has been until on the latest occasion event.widget was not the

Re: Tkinter binding question

2012-06-20 Thread Frederic Rentsch
On Tue, 2012-06-19 at 19:19 -0700, rantingrickjohn...@gmail.com wrote: On Tuesday, June 19, 2012 10:55:48 AM UTC-5, Frederic Rentsch wrote: If I copy your event descriptors into my program, the button-release callback still fails. It works in your code, not in mine. Here is what my code now

Re: Tkinter binding question

2012-06-19 Thread Frederic Rentsch
Rick, Thank you for your thorough discussion. I tried your little program. Enter and leave work as expected. Pushing mouse buttons call leave-enter, exactly as it happened with my code. So that seems to be a default behavior. No big deal. Without the tracing messages it would go unnoticed.

Tkinter binding question

2012-06-18 Thread Frederic Rentsch
Hi All, For most of an afternoon I've had that stuck-in-a-dead-end feeling probing to no avail all permutations formulating bindings, trying to make sense of manuals and tutorials. Here are my bindings: label_frame.bind ('Enter', self.color_selected) label_frame.bind ('Leave',

tkinter: is there a way to switch a widget's master?

2012-05-14 Thread Frederic Rentsch
Hi there, I would like to prepare a bunch of info text widgets to be displayed in Toplevel windows at the user's command (when ever he needs directions). I know how to remove and restore widgets without destroying them in between. The problem with a Toplevel is that it is a master that comes and

Re: Tkinter: IDLE can't get out of mainloop

2012-04-02 Thread Frederic Rentsch
On Sat, 2012-03-31 at 06:29 -0400, Terry Reedy wrote: On 3/31/2012 3:42 AM, Frederic Rentsch wrote: Hi all, Is is a bad idea to develop Tkinter applications in IDLE? I understand that IDLE is itself a Tkinter application, supposedly in a mainloop and mainloops apparently don't nest

Tkinter: IDLE can't get out of mainloop

2012-03-31 Thread Frederic Rentsch
Hi all, Is is a bad idea to develop Tkinter applications in IDLE? I understand that IDLE is itself a Tkinter application, supposedly in a mainloop and mainloops apparently don't nest. I tried to install a root-destroy-protocol: def destroy_root (): print 'Destroying root'

How to read image data into Tkinter Canvas?

2012-03-03 Thread Frederic Rentsch
Hi, Familiarizing myself with Tkinter I'm stuck trying to fill a Canvas with an image. I believe the class I need is PhotoImage rather than BitmapImage. But I have no luck with either. The PhotoImage doc lists available handlers for writing GIF and PPM files. It doesn't say anything about

try - except. How to identify errors unknown in advance?

2011-11-16 Thread Frederic Rentsch
Hi all, I'd like to log MySQL errors. If I do: try: (command) except MySQLdb.OperationalError, e: print e I may get something like: (1136, Column count doesn't match value count at row 1) If I don't know in advance which error to expect, but on the contrary want to

Re: try - except. How to identify errors unknown in advance?

2011-11-16 Thread Frederic Rentsch
On Wed, 2011-11-16 at 09:09 -0800, Chris Kaynor wrote: On Wed, Nov 16, 2011 at 8:57 AM, Frederic Rentsch anthra.nor...@bluewin.ch wrote: Hi all, I'd like to log MySQL errors. If I do: try: (command) except MySQLdb.OperationalError, e: print e I may get something

Re: String multi-replace

2010-11-18 Thread Frederic Rentsch
on the respective capabilities of the Python re module. 2. Regular expressions will not work as such but will be handled literally. Author: Frederic Rentsch (i...@anthra-norell.ch). def __init__ (self, definitions, eat = 0): ''' definitions: a sequence of pairs of strings. ((target

Re: Financial time series data

2010-09-04 Thread Frederic Rentsch
On Fri, 2010-09-03 at 19:58 +0200, Virgil Stokes wrote: import urllib2 import re def get_SP500_symbolsX (): symbols = [] lsttradestr = re.compile('Last Trade:') k = 0 for page in range(10): url = 'http://finance.yahoo.com/q/cp?s=%5EGSPCc='+str(page) print

Re: Financial time series data

2010-09-03 Thread Frederic Rentsch
On Fri, 2010-09-03 at 13:29 +0200, Virgil Stokes wrote: A more direct question on accessing stock information from Yahoo. First, use your browser to go to: http://finance.yahoo.com/q/cp?s=% 5EGSPC+Components Now, you see the first 50 rows of a 500 row table of information on SP 500

Re: Financial time series data

2010-09-03 Thread Frederic Rentsch
On Fri, 2010-09-03 at 16:48 +0200, Virgil Stokes wrote: On 03-Sep-2010 15:45, Frederic Rentsch wrote: On Fri, 2010-09-03 at 13:29 +0200, Virgil Stokes wrote: A more direct question on accessing stock information from Yahoo. First, use your browser to go to: http://finance.yahoo.com/q/cp

Re: expression in an if statement

2010-08-19 Thread Frederic Rentsch
On Thu, 2010-08-19 at 00:12 +0200, Thomas Jollans wrote: On Wednesday 18 August 2010, it occurred to John Nagle to exclaim: On 8/18/2010 11:24 AM, ernest wrote: Hi, In this code: if set(a).union(b) == set(a): pass Does Python compute set(a) twice? CPython does.

Re: Simple Problem but tough for me if i want it in linear time

2010-08-18 Thread Frederic Rentsch
On Mon, 2010-08-16 at 23:17 +, Steven D'Aprano wrote: On Mon, 16 Aug 2010 20:40:52 +0200, Frederic Rentsch wrote: How about [obj for obj in dataList if obj.number == 100] That should create a list of all objects whose .number is 100. No need to cycle through a loop. What

Re: Simple Problem but tough for me if i want it in linear time

2010-08-16 Thread Frederic Rentsch
On Sun, 2010-08-15 at 15:14 +0200, Peter Otten wrote: ChrisChia wrote: dataList = [a, b, c, ...] where a, b, c are objects of a Class X. In Class X, it contains self.name and self.number If i wish to test whether a number (let's say 100) appears in one of the object, and return

'reload M' doesn't update 'from M inport *'

2010-07-09 Thread Frederic Rentsch
I develop in an IDLE window. Module M says 'from service import *'. Next I correct a mistake in function 'service.f'. Now 'service.f' works fine. I do 'reload (service); reload (M)'. The function 'M.f' still misbehaves. 'print inspect.getsource (service.f)' and 'print inspect.getsource (M.f)'

Re: 'reload M' doesn't update 'from M inport *'

2010-07-09 Thread Frederic Rentsch
On Fri, 2010-07-09 at 15:58 +, Steven D'Aprano wrote: On Fri, 09 Jul 2010 15:02:25 +0200, Frederic Rentsch wrote: I develop in an IDLE window. Module M says 'from service import *'. Next I correct a mistake in function 'service.f'. Now 'service.f' works fine. from service import

Re: 'reload M' doesn't update 'from M inport *'

2010-07-09 Thread Frederic Rentsch
On Fri, 2010-07-09 at 19:38 +0200, Jean-Michel Pichavant wrote: Frederic Rentsch wrote: I develop in an IDLE window. Module M says 'from service import *'. Next I correct a mistake in function 'service.f'. Now 'service.f' works fine. I do 'reload (service); reload (M

Requesting direction for installation problem

2008-11-26 Thread Frederic Rentsch
Hi, Where can one get assistance if a Windows installation service fails to install an msi installer? I used to download zip files, but they seem to have been replaced with msi files. I know this issue is off topic here. So my question simply is: where is it not off topic? Thanks for any

Re: problem deriving form type long

2008-01-23 Thread Frederic Rentsch
Gabriel Genellina wrote: En Mon, 21 Jan 2008 18:33:10 -0200, Frederic Rentsch [EMAIL PROTECTED] escribió: Hi, here's something that puzzles me: class Fix_Point (long): def __init__ (self, l): long.__init__ (self, l * 0x1): fp = Fix_Point (99) fp 99

problem deriving form type long

2008-01-21 Thread Frederic Rentsch
Hi, here's something that puzzles me: class Fix_Point (long): def __init__ (self, l): long.__init__ (self, l * 0x1): fp = Fix_Point (99) fp 99 With prints: class Fix_Point (long): def __init__ (self, l): print l l_ = l * 2

Re: Parsing HTML

2007-02-14 Thread Frederic Rentsch
mtuller wrote: Alright. I have tried everything I can find, but am not getting anywhere. I have a web page that has data like this: tr td headers=col1_1 style=width:21% span class=hpPageText LETTER/span/td td headers=col2_1 style=width:13%; text-align:right span class=hpPageText

Re: Find and replace in a file with regular expression

2007-02-03 Thread Frederic Rentsch
TOXiC wrote: Hi everyone, First I say that I serched and tryed everything but I cannot figure out how I can do it. I want to open a a file (not necessary a txt) and find and replace a string. I can do it with: import fileinput, string, sys fileQuery = Text.txt sourceText = '''SOURCE'''

Re: Type casting a base class to a derived one?

2007-01-15 Thread Frederic Rentsch
Chris Mellon wrote: On 11 Jan 2007 15:01:48 +0100, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-01-11, Frederic Rentsch [EMAIL PROTECTED] wrote: If I derive a class from another one because I need a few extra features, is there a way to promote the base class to the derived one

Type casting a base class to a derived one?

2007-01-11 Thread Frederic Rentsch
Hi all, If I derive a class from another one because I need a few extra features, is there a way to promote the base class to the derived one without having to make copies of all attributes? class Derived (Base): def __init__ (self, base_object): # ( copy all attributes ) ...

Re: textwrap.dedent replaces tabs?

2006-12-29 Thread Frederic Rentsch
Tom Plunket wrote: Frederic Rentsch wrote: Your rules seem incomplete. Not my rules, the stated documentation for dedent. My understanding of them may not be equivalent to yours, however. It's not about understanding, It's about the objective. Let us consider the difference

Re: textwrap.dedent replaces tabs?

2006-12-28 Thread Frederic Rentsch
Tom Plunket wrote: Frederic Rentsch wrote: It this works, good for you. I can't say I understand your objective. (You dedent common leading tabs, except if preceded by common leading spaces (?)). I dedent common leading whitespace, and tabs aren't equivalent to spaces. E.g

Re: BeautifulSoup vs. loose chars

2006-12-26 Thread Frederic Rentsch
John Nagle wrote: Felipe Almeida Lessa wrote: On 26 Dec 2006 04:22:38 -0800, placid [EMAIL PROTECTED] wrote: So do you want to remove or replace them with amp; ? If you want to replace it try the following; I think he wants to replace them, but just the invalid ones. I.e.,

Re: textwrap.dedent replaces tabs?

2006-12-24 Thread Frederic Rentsch
Tom Plunket wrote: Frederic Rentsch wrote: Following a call to dedent () it shouldn't be hard to translate leading groups of so many spaces back to tabs. Sure, but the point is more that I don't think it's valid to change to tabs in the first place. E.g.: input = ' ' + '\t

Re: textwrap.dedent replaces tabs?

2006-12-22 Thread Frederic Rentsch
Tom Plunket wrote: Frederic Rentsch wrote: Well, there is that small problem that there are leading tabs that I want stripped. I guess I could manually replace all tabs with eight spaces (as opposed to 'correct' tab stops), and then replace them when done, but it's probably just as easy

Re: textwrap.dedent replaces tabs?

2006-12-17 Thread Frederic Rentsch
Tom Plunket wrote: CakeProphet wrote: Hmmm... a quick fix might be to temporarily replace all tab characters with another, relatively unused control character. MyString = MyString.replace(\t, chr(1)) MyString = textwrap.dedent(MyString) MyString = MyString.replace(chr(1), \t) Of

Re: Python spam?

2006-12-01 Thread Frederic Rentsch
Hendrik van Rooyen wrote: Aahz [EMAIL PROTECTED] wrote: Anyone else getting Python-related spam? So far, I've seen messages from Barry Warsaw and Skip Montanaro (although of course header analysis proves they didn't send it). -- not like that - just the normal crud from people

Re: splitting a long string into a list

2006-11-29 Thread Frederic Rentsch
ronrsr wrote: still having a heckuva time with this. here's where it stand - the split function doesn't seem to work the way i expect it to. longkw1,type(longkw): Agricultural subsidies; Foreign aid;Agriculture; Sustainable Agriculture - Support; Organic Agriculture; Pesticides, US,

Re: utf - string translation

2006-11-29 Thread Frederic Rentsch
Dan wrote: On 22 nov, 22:59, John Machin [EMAIL PROTECTED] wrote: processes (Vigenère) So why do you want to strip off accents? The history of communication has several examples of significant difference in meaning caused by minute differences in punctuation or accents including

Re: multi split function taking delimiter list

2006-11-16 Thread Frederic Rentsch
Paddy wrote: Paddy wrote: Paddy wrote: [EMAIL PROTECTED] wrote: Hi, I'm looking for something like: multi_split( 'a:=b+c' , [':=','+'] ) returning: ['a', ':=', 'b', '+', 'c'] whats the python way to achieve this, preferably without regexp? Thanks. Martin I resisted my urge to

Re: Seeking assistance - string processing.

2006-11-14 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: I've been working on some code to search for specific textstrings and act upon them insome way. I've got the conversion sorted however there is 1 problem remaining. I am trying to work out how to make it find a string like this === and when it has found it, I want it

Re: Character encoding

2006-11-08 Thread Frederic Rentsch
mp wrote: I have html document titles with characters like gt;, nbsp;, and #135. How do I decode a string with these values in Python? Thanks This is definitely the most FAQ. It comes up about once a week. The stream-editing way is like this: import SE HTM_Decoder = SE.SE

Re: string to list of numbers conversion

2006-11-06 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: Hi, I have a string '((1,2), (3,4))' and I want to convert this into a python tuple of numbers. But I do not want to use eval() because I do not want to execute any code in that string and limit it to list of numbers. Is there any alternative way? Thanks.

Re: ANN: SE 2.3. Available now

2006-11-04 Thread Frederic Rentsch
Fredrik Lundh wrote: Frederic Rentsch wrote: And here's the proof I am being perceived as a nuisance. I apologize, keeping to myself that I don't care. since you're constantly targeting newbies, and are hawking your stuff also for things for which there are simple and efficient

Re: SE 2.3 temporarily unavailable. Cheese shop defeats upload with erratic behavior. Urgently requesting help.

2006-11-03 Thread Frederic Rentsch
jim-on-linux wrote: Frederic, I've been trying to get back into my package in the Cheese Shop for over a year. The phone company changed my e:mail address and to make a long and frustrating story short I can't get back into the Cheese Shop to make changes to my file. Time is money.

ANN: SE 2.3. Available now

2006-11-03 Thread Frederic Rentsch
A few Cheese Shop upload problems have been solved with the help of this creative group. Thank you all! Version 2.2 beta should be phased out. It has a functional defect, missing matches with a very low statistical probability. Version 2.3 has this fixed. Download URL:

Re: SE

2006-11-03 Thread Frederic Rentsch
C or L Smith wrote: Hello, I'm evaluating different methods of handling a transliteration (from an ascii-based representation of the devanagari/indian script to a romanized representation). I found SE and have been working with it today. One thing that I ran into (that I don't see a

Re: ANN: SE 2.3. Available now

2006-11-03 Thread Frederic Rentsch
Gary Herron wrote: Frederic Rentsch wrote: A few Cheese Shop upload problems have been solved with the help of this creative group. Thank you all! Version 2.2 beta should be phased out. It has a functional defect, missing matches with a very low statistical probability. Version 2.3 has

Re: ANN: SE 2.3. Available now

2006-11-03 Thread Frederic Rentsch
Fredrik Lundh wrote: Gary Herron wrote: As a matter of polite netiquette, a message like this really ought to have a paragraph telling us what SE *is*.(Unless it's a secret :-)) nah, if you've spent more than five minutes on c.l.python lately, you'd noticed that it's the

Re: unescape HTML entities

2006-11-02 Thread Frederic Rentsch
. Thanks, Ray Frederic Rentsch wrote: Rares Vernica wrote: Hi, How can I unescape HTML entities like nbsp;? I know about xml.sax.saxutils.unescape() but it only deals with amp;, lt;, and gt;. Also, I know about htmlentitydefs.entitydefs, but not only this dictionary

SE 2.3 temporarily unavailable. Cheese shop defeats upload with erratic behavior. Urgently requesting help.

2006-11-02 Thread Frederic Rentsch
Some time ago I had managed to upload a small package to the Cheese Shop using the data entry template. Uploading is in two steps: first the text then the package file. When I had a new version it went like this: The new text made a new page, but the new file went to the old page. The old page

Re: unescape HTML entities

2006-11-02 Thread Frederic Rentsch
;=(xf9) # 249 f9 uacute;=(xfa) # 250 fa ucirc;=(xfb)# 251 fb uuml;=(xfc) # 252 fc yacute;=(xfd) # 253 fd thorn;=(xfe)# 254 fe #233;=(xe9) #234;=(xea) #235;=(xeb) #236;=(xec) #237;=(xed) #238;=(xee) #239;=(xef) In [19]: Thanks, Ray Frederic Rentsch wrote

Re: Where do nested functions live?

2006-11-01 Thread Frederic Rentsch
Rob Williscroft wrote: Frederic Rentsch wrote in news:mailman.1556.1162316571.11739.python- [EMAIL PROTECTED] in comp.lang.python: Rob Williscroft wrote: Frederic Rentsch wrote in news:mailman.1536.1162292996.11739.python- Rob Williscroft wrote: Frederic Rentsch

Re: Where do nested functions live?

2006-10-31 Thread Frederic Rentsch
Rob Williscroft wrote: Frederic Rentsch wrote in news:mailman.1428.1162113628.11739.python- [EMAIL PROTECTED] in comp.lang.python: def increment_time (interval_ms): outer weeks, days, hours, minutes, seconds, mseconds # 'outer' akin to 'global' (...) mseconds

Re: Where do nested functions live?

2006-10-31 Thread Frederic Rentsch
Rob Williscroft wrote: Frederic Rentsch wrote in news:mailman.1536.1162292996.11739.python- [EMAIL PROTECTED] in comp.lang.python: Rob Williscroft wrote: Frederic Rentsch wrote in news:mailman.1428.1162113628.11739.python- [EMAIL PROTECTED] in comp.lang.python

Re: How to convert nbsp; in a string to blank space?

2006-10-30 Thread Frederic Rentsch
一首诗 wrote: Oh, I didn't make myself clear. What I mean is how to convert a piece of html to plain text bu keep as much format as possible. Such as convert nbsp; to blank space and convert br to \r\n Gary Herron wrote: 一首诗 wrote: Is there any simple way to solve this problem?

Re: Where do nested functions live?

2006-10-29 Thread Frederic Rentsch
Diez B. Roggisch wrote: If I may turn the issue around, I could see a need for an inner function to be able to access the variables of the outer function, the same way a function can access globals. Why? Because inner functions serve to de-multiply code segments one would otherwise need to

Re: unescape HTML entities

2006-10-29 Thread Frederic Rentsch
Rares Vernica wrote: Hi, How can I unescape HTML entities like nbsp;? I know about xml.sax.saxutils.unescape() but it only deals with amp;, lt;, and gt;. Also, I know about htmlentitydefs.entitydefs, but not only this dictionary is the opposite of what I need, it does not have nbsp;.

Re: Where do nested functions live?

2006-10-29 Thread Frederic Rentsch
Fredrik Lundh wrote: Frederic Rentsch wrote: At some later point I need to increment my units some more and probably will again a number of times. Clearly this has to go into a function. since Python is an object-based language, clearly you could make your counter into a self

Re: Where do nested functions live?

2006-10-28 Thread Frederic Rentsch
Fredrik Lundh wrote: Steven D'Aprano wrote: I defined a nested function: def foo(): def bar(): return bar return foo + bar() which works. Knowing how Python loves namespaces, I thought I could do this: foo.bar() Traceback (most recent call

Re: Search Replace

2006-10-27 Thread Frederic Rentsch
DataSmash wrote: Hello, I need to search and replace 4 words in a text file. Below is my attempt at it, but this code appends a copy of the text file within itself 4 times. Can someone help me out. Thanks! # Search Replace file = open(text.txt, r) text = file.read() file.close() file

Re: Attempting to parse free-form ANSI text.

2006-10-25 Thread Frederic Rentsch
Dennis Lee Bieber wrote: On Mon, 23 Oct 2006 20:34:20 +0100, Steve Holden [EMAIL PROTECTED] declaimed the following in comp.lang.python: Don't give up, attach it as a file! Which might be acceptable on a mailing list, but might be problematic on a text newsgroup... Though

Re: mean ans std dev of an array?

2006-10-25 Thread Frederic Rentsch
SpreadTooThin wrote: import array a = array.array('f', [1,2,3]) print a.mean() print a.std_dev() Is there a way to calculate the mean and standard deviation on array data? Do I need to import it into a Numeric Array to do this? I quickly fish this out of my functions toolbox.

Re: Attempting to parse free-form ANSI text.

2006-10-24 Thread Frederic Rentsch
Steve Holden wrote: Frederic Rentsch wrote: Frederic Rentsch wrote: Frederic Rentsch wrote: Paul McGuire wrote: Michael B. Trausch mike$#at^nospam!%trauschus wrote in message Sorry about the line wrap mess in the previous message. I try

Re: can't open word document after string replacements

2006-10-24 Thread Frederic Rentsch
Antoine De Groote wrote: Hi there, I have a word document containing pictures and text. This documents holds several 'ABCDEF' strings which serve as a placeholder for names. Now I want to replace these occurences with names in a list (members). I open both input and output file in binary

Re: Attempting to parse free-form ANSI text.

2006-10-23 Thread Frederic Rentsch
Paul McGuire wrote: Michael B. Trausch mike$#at^nospam!%trauschus wrote in message news:[EMAIL PROTECTED] Alright... I am attempting to find a way to parse ANSI text from a telnet application. However, I am experiencing a bit of trouble. What I want to do is have all ANSI sequences

Re: Attempting to parse free-form ANSI text.

2006-10-23 Thread Frederic Rentsch
Frederic Rentsch wrote: Paul McGuire wrote: Michael B. Trausch mike$#at^nospam!%trauschus wrote in message Sorry about the line wrap mess in the previous message. I try again with another setting: Frederic

Re: Attempting to parse free-form ANSI text.

2006-10-23 Thread Frederic Rentsch
Frederic Rentsch wrote: Frederic Rentsch wrote: Paul McGuire wrote: Michael B. Trausch mike$#at^nospam!%trauschus wrote in message Sorry about the line wrap mess in the previous message. I try again with another setting: Frederic I give up! -- http

Re: Attempting to parse free-form ANSI text.

2006-10-22 Thread Frederic Rentsch
Michael B. Trausch wrote: Alright... I am attempting to find a way to parse ANSI text from a telnet application. However, I am experiencing a bit of trouble. What I want to do is have all ANSI sequences _removed_ from the output, save for those that manage color codes or text presentation

Re: File read-write mode: problem appending after reading

2006-10-16 Thread Frederic Rentsch
Tim Peters wrote: [Frederic Rentsch] Thanks a lot for your input. I seemed to notice that everything works fine without setting the cursor as long as it stops before the end of the file. Is that also a coincidence that may not work? if you want to read following a write

Re: Ok. This IS homework ...

2006-10-16 Thread Frederic Rentsch
spawn wrote: but I've been struggling with this for far too long and I'm about to start beating my head against the wall. My assignment seemed simple: create a program that will cacluate the running total of user inputs until it hits 100. At 100 it should stop. That's not the problem, in

Re: Ok. This IS homework ...

2006-10-16 Thread Frederic Rentsch
Nick Craig-Wood wrote: Frederic Rentsch [EMAIL PROTECTED] wrote: It was called a flow chart. Flow charts could be translated directly into machine code written in assembly languages which had labels, tests and jumps as the only flow-control constructs. When structured programming

Re: Insert characters into string based on re ?

2006-10-15 Thread Frederic Rentsch
Frederic Rentsch wrote: Matt wrote: I am attempting to reformat a string, inserting newlines before certain phrases. For example, in formatting SQL, I want to start a new line at each JOIN condition. Noting that strings are immutable, I thought it best to spllit the string at the key points

Re: File read-write mode: problem appending after reading

2006-10-14 Thread Frederic Rentsch
Tim, Thanks a lot for your input. I seemed to notice that everything works fine without setting the cursor as long as it stops before the end of the file. Is that also a coincidence that may not work? Frederic Tim Peters wrote: [Frederic Rentsch] Working with read and write

Re: Insert characters into string based on re ?

2006-10-14 Thread Frederic Rentsch
Matt wrote: I am attempting to reformat a string, inserting newlines before certain phrases. For example, in formatting SQL, I want to start a new line at each JOIN condition. Noting that strings are immutable, I thought it best to spllit the string at the key points, then join with '\n'.

File read-write mode: problem appending after reading

2006-10-13 Thread Frederic Rentsch
Hi all, Working with read and write operations on a file I stumbled on a complication when writes fail following a read to the end. f = file ('T:/z', 'r+b') f.write ('abcdefg') f.tell () 30L f.seek (0) f.read () 'abcdefg' f.flush () # Calling or not makes no difference f.write

Re: Operator += works once, fails if called again

2006-10-03 Thread Frederic Rentsch
John Machin wrote: Frederic Rentsch wrote: Hi all, I have a class Time_Series derived from list. It lists days and contains a dictionary of various Lists also derived from list which contain values related to said days. (e.g. Stock quotes, volumes traded, etc.) I defined

Operator += works once, fails if called again

2006-10-02 Thread Frederic Rentsch
Hi all, I have a class Time_Series derived from list. It lists days and contains a dictionary of various Lists also derived from list which contain values related to said days. (e.g. Stock quotes, volumes traded, etc.) I defined an operator += which works just fine, but only once. If I

Re: Escapeism

2006-10-01 Thread Frederic Rentsch
Kay Schluehr wrote: Sybren Stuvel wrote: Kay Schluehr enlightened us with: Usually I struggle a short while with \ and either succeed or give up. Today I'm in a different mood and don't give up. So here is my question: You have an unknown character string c such as '\n' , '\a' ,

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-29 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: Frederic Rentsch: Good idea, but shorter with - SE.SE ('se_definition_files/int_to_binary.se') ('%X' % 987654321) '0011101011000110100010110001' Note that your version keeps the leading zeros. Have you tested the relative speeds too? (I'll probably

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-28 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: Mirco Wahab: But where is the %b in Python? Python doesn't have that. You can convert the number to a hex, and then map the hex digitds to binary strings using a dictionary, like this: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440528 Bye,

Re: I need some help with a regexp please

2006-09-26 Thread Frederic Rentsch
Dennis Lee Bieber wrote: On 25 Sep 2006 10:25:01 -0700, codefire [EMAIL PROTECTED] declaimed the following in comp.lang.python: Yes, I didn't make it clear in my original post - the purpose of the code was to learn something about regexps (I only started coding Python last week). In

Re: newbe's re question

2006-09-26 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: Frederic Rentsch wrote: [EMAIL PROTECTED] wrote: These are csound files. Csound recently added python as a scripting language and is allowing also allowing csound calls from outside of csound. The nice thing about csound is that instead of worrying about

Re: newbe's re question

2006-09-24 Thread Frederic Rentsch
that is almost unreadable at times (would look nice in a grid) http://www.msn.com .. Frederic Rentsch wrote: [EMAIL PROTECTED] wrote: Frederic Rentsch wrote: [EMAIL PROTECTED] wrote: Frederic Rentsch wrote: [EMAIL PROTECTED] wrote

Re: Replacing line in a text file

2006-09-22 Thread Frederic Rentsch
CSUIDL PROGRAMMEr wrote: Folks I am trying to read a file This file has a line containing string 'disable = yes' I want to change this line to 'disable = no' The concern here is that , i plan to take into account the white spaces also. I tried copying all file int list and then tried to

Re: newbe's re question

2006-09-21 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: Frederic Rentsch wrote: [EMAIL PROTECTED] wrote: Frederic Rentsch wrote: [EMAIL PROTECTED] wrote: All I am after realy is to change this reline = re.line.split('instr', '/d$') into something that grabs any line with instr in it take

Re: newbe's re question

2006-09-20 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: All I am after realy is to change this reline = re.line.split('instr', '/d$') into something that grabs any line with instr in it take all the numbers and then grab any comment that may or may not be at the end of the line starting with ; until the end of the line

Re: newbe's re question

2006-09-20 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: Frederic Rentsch wrote: [EMAIL PROTECTED] wrote: All I am after realy is to change this reline = re.line.split('instr', '/d$') into something that grabs any line with instr in it take all the numbers and then grab any comment that may or may

Re: How to change font direction?

2006-09-18 Thread Frederic Rentsch
theju wrote: Well here are some self explanatory functions that I've written for displaying the text vertically and from right to left. As for rotation gimme some more time and i'll come back to you. Also I don't guarantee that this is the best method(cos I myself am a newbie), but I can

Re: stock quotes

2006-09-14 Thread Frederic Rentsch
Donlingerfelt wrote: I would like to download stock quotes from the web, store them, do calculations and sort the results. However I am fairly new and don't have a clue how to parse the results of a web page download. I can get to the site, but do not know how to request the certain data

Re: How to get the longest possible match with Python's RE module?

2006-09-13 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: Frederic Rentsch wrote: If you need regexes, why not just reverse-sort your expressions? This seems a lot easier and faster than writing another regex compiler. Reverse-sorting places the longer ones ahead of the shorter ones. Unfortunately, not all

Re: How to get the longest possible match with Python's RE module?

2006-09-13 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: Frederic Rentsch wrote: If you need regexes, why not just reverse-sort your expressions? This seems a lot easier and faster than writing another regex compiler. Reverse-sorting places the longer ones ahead of the shorter ones. Unfortunately, not all

Re: How to get the longest possible match with Python's RE module?

2006-09-12 Thread Frederic Rentsch
Licheng Fang wrote: Basically, the problem is this: p = re.compile(do|dolittle) p.match(dolittle).group() 'do' Python's NFA regexp engine trys only the first option, and happily rests on that. There's another example: p = re.compile(one(self)?(selfsufficient)?)