あるフリーランスエンジニアの色んなメモ!! ITスキル・ライフハックとか

Python:1linerでランダムな文字列を得る

UUIDを出力

UUID4

python -c "import uuid;print(uuid.uuid4())"

出力例

8766631b-5350-4269-8c75-817a506b6f96

ランダム文字列を出力

ランダムな40文字(英字+数字)

python -c "import string;import secrets;print(''.join([secrets.choice(string.ascii_letters+string.digits) for i in range(40)]))"

出力例

eWVZIX8VyxThN0DWVSxbauVZfmf0lMRHEaVvMOYo
comments powered by Disqus