Python判斷字符串是否全是字母或數字


str.isnumeric(): True if 只包含數字;otherwise False。注意:此函數只能用於unicode string

str.isdigit(): True if 只包含數字;otherwise False。

str.isalpha():True if 只包含字母;otherwise False。

str.isalnum():True if 只包含字母或者數字;otherwise False。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM