Using filepath method to identify an .html page
__peter__ at web.de
Tue Jan 22 16:25:42 CET 2013
Ferrous Cranus wrote:
> I insist, perhaps compeleld, to use a key to associate a number to a
> filename. Would you help please?
> I dont know this is supposed to be written. i just know i need this:
> number = function_that_returns_a_number_out_of_a_string(
> Would someone help me write that in python coding? We are talkign 1 line
> of code here....
Since you insist:
>>> def function_that_returns_a_number_out_of_a_string(absolute_path_of_a_html_file):
... return int(absolute_path_of_a_html_file.encode("hex"), 16)
As a bonus here is how to turn the number back into a path:
>>> x = 14669632128886499728813089146
More information about the Python-list