Re: why I don't like range/xrange

2007-02-16 Thread Samuel Karl Peterson
Roel Schroeven <[EMAIL PROTECTED]> on Sat, 17 Feb 2007 01:31:13 GMT didst step forth and proclaim thus: ... > So, the point is that in C you can influence the loop's behavior by > modifying the loop variable, while you cannot do that in Python (at > least not in a for-loop). What's wrong with...

Re: string.replace non-ascii characters

2007-02-11 Thread Samuel Karl Peterson
Steven Bethard <[EMAIL PROTECTED]> on Sun, 11 Feb 2007 22:23:59 -0700 didst step forth and proclaim thus: > Samuel Karl Peterson wrote: > > Greetings Pythonistas. I have recently discovered a strange anomoly > > with string.replace. It seemingly, randomly does not deal w

Re: searching a list of lists as a two-dimensional array?

2007-02-11 Thread Samuel Karl Peterson
James Stroud <[EMAIL PROTECTED]> on Sun, 11 Feb 2007 16:53:16 -0800 didst step forth and proclaim thus: > agent-s wrote: > > Basically I'm programming a board game and I have to use a list of > > lists to represent the board (a list of 8 lists with 8 elements each). > > I have to search the adjace

Re: About getattr()

2007-02-11 Thread Samuel Karl Peterson
"Jm lists" <[EMAIL PROTECTED]> on Mon, 12 Feb 2007 12:36:10 +0800 didst step forth and proclaim thus: > Hello, > > Since I can write the statement like: > > >>> print os.path.isdir.__doc__ > Test whether a path is a directory > > Why do I still need the getattr() func as below? > > >>> print g

string.replace non-ascii characters

2007-02-11 Thread Samuel Karl Peterson
Greetings Pythonistas. I have recently discovered a strange anomoly with string.replace. It seemingly, randomly does not deal with characters of ordinal value > 127. I ran into this problem while downloading auction web pages from ebay and trying to replace the "\xa0" (dec 160, nbsp char in iso-

Re: No module named pyExcelerator Error

2007-02-11 Thread Samuel Karl Peterson
"susan" <[EMAIL PROTECTED]> on 11 Feb 2007 16:55:35 -0800 didst step forth and proclaim thus: > Hi, > I'm new of Python, and this problem stucked me whole day but can't be > solved. [snip] > anybody can tell me where's wrong please? Thanks in advance! What are the contents of sys.path from an i

Re: How to find all the same words in a text?

2007-02-11 Thread Samuel Karl Peterson
[EMAIL PROTECTED] on 11 Feb 2007 08:16:11 -0800 didst step forth and proclaim thus: > More concisely: > > import re > > pattern = re.compile(r'\b324\b') > indices = [ match.start() for match in > pattern.finditer(target_string) ] > print "Indices", indices > print "Count: ", len(indices) > Tha

Re: How to find all the same words in a text?

2007-02-11 Thread Samuel Karl Peterson
"Johny" <[EMAIL PROTECTED]> on 10 Feb 2007 05:29:23 -0800 didst step forth and proclaim thus: > I need to find all the same words in a text . > What would be the best idea to do that? I make no claims of this being the best approach: def findOccurances(a_string, word):

Re: Parsing HTML

2007-02-11 Thread Samuel Karl Peterson
"mtuller" <[EMAIL PROTECTED]> on 10 Feb 2007 15:03:36 -0800 didst step forth and proclaim thus: > Alright. I have tried everything I can find, but am not getting > anywhere. I have a web page that has data like this: [snip] > What is show is only a small section. > > I want to extract the 33,69