#climatechange Temperatures in Arizona 1895-2018

monkinetic the blog

string.hexdigits

I recently found the following in a bit of #python sample code:

random_data = random.sample(string.hexdigits, 8)

Wait, hexdigits? I’d use string.ascii_letters and string.ascii_lowercase before, but this was the first time I’d seen hexdigits, which is exactly what you’d think:

The string ‘0123456789abcdefABCDEF’.

That’s useful.

#python #programming