網站首頁 編程語言 正文
代碼和代碼運行的結果:
代碼:
import itertools as its words="rot123" a=its.product(words,repeat=4) name=open("pass.txt","a") for i in a: name.write("".join(i)) name.write("".join("\n")) name.close()
代碼解析:
#導入模塊
import itertools as its
#設的密碼“元素”,就是破解密碼的字符
words="rot123"
#its=itertools,repeat是生成密碼的個數
a=its.product(words,repeat=4)
#寫文件名稱,“a”是以追加密模式打開
name=open("pass.txt","a")
#for循環——相當于循環words
for i in a:
#join是將元素以指定的字符連接生成一個新的字符串,“”是以什么連接輸出
??? name.write("".join(i)) #\n是換行
??? name.write("".join("\n")) #輸出完之后,close關閉打開的文件
name.close()
效果圖:
原文鏈接:https://blog.csdn.net/YZ913/article/details/122526347
相關推薦
- 2022-09-12 輕量級域名解析服務器之dnsmasq的介紹與部署_服務器其它
- 2022-08-16 C#工程建立后修改工程文件名與命名空間操作_C#教程
- 2023-09-17 ES常見錯誤總結
- 2022-04-09 c語言循環加數組實現漢諾塔問題_C 語言
- 2022-10-16 Pytorch?linear?多維輸入的參數問題_python
- 2023-02-23 GoLang中的互斥鎖Mutex和讀寫鎖RWMutex使用教程_Golang
- 2024-03-23 springboot項目中如何獲取請求頭當中的token
- 2022-05-01 jquery實現移動端按鈕組左右滑動_jquery
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支