利用os和base64生成随机字符串
import os
import base64
a = os.urandom(46)
b = base64.b64encode(a)
print(b) # b'yn5VoGp1+LNzG8NqjMCFfAzqWrqwj+mR1u2tCKJDaqKPnMGCHMFruazlQAG4Hg=='
print(b.decode('utf-8')) # yn5VoGp1+LNzG8NqjMCFfAzqWrqwj+mR1u2tCKJDaqKPnMGCHMFruazlQAG4Hg==