random choice from dictionary

sarah123ed at gmail.com sarah123ed at gmail.com
Mon Dec 24 00:17:02 EST 2018



Maybe something like this:

    import random
    k = list(data.keys())
    random.shuffle(k)
    result = data[k[0]]


    



More information about the Python-list mailing list