python 随机生成36位数
时间: 2023-10-15 07:31:47 浏览: 134
根据引用中提供的信息,可以通过以下代码实现Python随机生成36位数的功能:
```python
import random
def generate_password(length):
password = ''.join(random.sample('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', length))
return password
password = generate_password(36)
```
这段代码使用了`random.sample`函数来从指定的序列中获取指定个数的随机元素,其中序列包含了所有的数字和字母。生成的密码长度为36位,包括数字和大小写字母。你可以根据需要修改密码的长度。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [python 随机生成10位数密码的实现代码](https://download.csdn.net/download/weixin_38507923/12862329)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Python随机生成6位数密码](https://blog.csdn.net/ckckjsws/article/details/126866343)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文