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( > absolute_path_of_a_html_file) > > 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) ... >>> function_that_returns_a_number_out_of_a_string("/foo/bar/baz") 14669632128886499728813089146L As a bonus here is how to turn the number back into a path: >>> x = 14669632128886499728813089146 >>> "{:x}".format(x).decode("hex") '/foo/bar/baz' ;) -- http://mail.python.org/mailman/listinfo/python-list