Generate a custom formated string with python
问题 I have a Javascript code that generates a string (similar to uuid) string Here it is the js code: var t = "xxxxxxxx-xxxx-xxxx-xxxx-xxxx-xxxxxxxx" , i = (new Date).getTime(); return e = t.replace(/[x]/g, function() { var e = (i + 16 * Math.random()) % 16 | 0; return i = Math.floor(i / 16), e.toString(16) }) How can I generate this string with python? 回答1: Using regular expression substitution and the new secrets module of Python 3.6 - this is not equivalent to the JavaScript code because this