Python 中的 string.punctuation
在本教程中,我們將學習瞭解 string.punctuation 字串。
字串 punctuation 在 Python 3 的 string 模組中預定義。它將所有字元作為字串包含在內。我們可以在程式的任何位置使用它。
示例
# importing the string module import string # printing the punctuation print(string.punctuation)
輸出
如果你執行上述程式碼,將會得到以下結果。
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~結論
我們可以使用它來生成強密碼。嘗試一下。如果你在教程中遇到任何疑問,請在註釋部分提出。
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP