Τη Τρίτη, 22 Ιανουαρίου 2013 3:04:41 μ.μ. UTC+2, ο χρήστης Steven D'Aprano έγραψε:
> What do you expect int("my-web-page.html") to return? Should it return 23 > or 794 or 109432985462940911485 or 42? I expected a unique number from the given string to be produced so i could have a (number <=> string) relation. What does int( somestring ) is returning really? i don;t have IDLE to test. > Just tell your database to make the file name an indexed field, and it > > will handle giving every path a unique number for you. You can then > > forget all about that unique number, because it is completely irrelevant > > to you, and safely use the path while the database treats it in the > > fastest and most efficient fashion necessary. This counter.py will work on a shared hosting enviroment, so absolutes paths are BIG and expected like this: /home/nikos/public_html/varsa.gr/articles/html/files/index.html In addition to that my counter.py script maintains details in a database table that stores information for each and every webpage requested. My 'visitors' database has 2 tables: pin --- page ---- hits (that's to store general information for all html pages) pin <-refers to-> page pin ---- host ---- hits ---- useros ---- browser ---- date (that's to store detailed information for all html pages) (thousands of records to hold every page's information) 'pin' has to be a number because if i used the column 'page' instead, just imagine the database's capacity withholding detailed information for each and every .html requested by visitors!!! So i really - really need to associate a (4-digit integer <=> htmlpage's absolute path) Maybe it can be done by creating a MySQL association between the two columns, but i dont know how such a thing can be done(if it can). So, that why i need to get a "unique" number out of a string. please help. -- http://mail.python.org/mailman/listinfo/python-list