Changing variable to integer

2006-12-17 Thread vertigo
Hello I receive such error: File "p4.py", line 24, in PrintWordCountFloat print "%s %f" % (word,words[word]) TypeError: list indices must be integers i call PrintWordCountFloat with hash table, keys are words(string) and values float. This part of the code: def PrintWordCountFloat(words)

Re: Changing variable to integer

2006-12-17 Thread vertigo
> Perhaps you meant something more along the lines of this: > def PrintWordCountFloat(words): > number = 0 > for index, word in enumerate(words): > print "%s %f" % (index, word) > number = number + 1 > print "Total words: %d" %(number) PrintW

Re: Changing variable to integer

2006-12-17 Thread vertigo
On Sun, 17 Dec 2006 17:00:46 +0100, Juho Schultz <[EMAIL PROTECTED]> wrote: > vertigo wrote: >> > Perhaps you meant something more along the lines of this: >> > >> >>>> def PrintWordCountFloat(words): >> >number = 0 >> >fo

length of multidimensional table

2006-12-17 Thread vertigo
Hello i have: x = zeros([3,4],Float) how can i check how many rows and columns x have ? (what is the X and Y size of that table) ? Thanx -- http://mail.python.org/mailman/listinfo/python-list

url filtering

2006-12-17 Thread vertigo
Hello I want to do some text analysis based on html documents grabbed from internet. Is there any library which could allow me easily getting text from html documents (cutting javascript, html tags and other not nececary data) ? Thanx -- http://mail.python.org/mailman/listinfo/python-list

trees

2006-12-17 Thread vertigo
Hello What library/functions/classes could i use to create trees ? Thanx -- http://mail.python.org/mailman/listinfo/python-list

regexp

2006-12-19 Thread vertigo
Hello I need to use some regular expressions for more than one line. And i would like to use some modificators like: /m or /s in perl. For example: re.sub(".*","",data) will not cut out all javascript code if it's spread on many lines. I could use something like /s from perl which treats . as all

Re: regexp

2006-12-19 Thread vertigo
> vertigo wrote: >> I need to use some regular expressions for more than one line. >> And i would like to use some modificators like: /m or /s in perl. >> For example: >> re.sub(".*","",data) >> will not cut out all javascript code if

Re: regexp

2006-12-19 Thread vertigo
Hello > On Tuesday 19 December 2006 13:15, vertigo wrote: >> Hello >> >> I need to use some regular expressions for more than one line. >> And i would like to use some modificators like: /m or /s in perl. >> For example: >> re.sub(".*","&quo

Re: regexp

2006-12-19 Thread vertigo
Hello Thanx for help, i have one more question: i noticed that while matching regexp python tries to match as wide as it's possible, for example: re.sub("","",htmldata) would cut out everything before first "" in the document. Can i force re to math as narrow as possible ? (to match first ""

trees, iterations and adding leaves

2006-12-31 Thread vertigo
Hello I have trees like this: >>> from nltk_lite.parse.tree import Tree >>> tree6 = Tree('main', ['sub1', 'sub2']) >>> tree6 ('main': 'sub1' 'sub2') I use nltk package - but it should not matter here. I could change it's lafes (add node) like this: >>> tree6[0] = Tree('newsub',[]) >>> tree6 ('ma