首页 > 编程语言 > 详细

python 的isdigit()

时间:2020-03-25 14:49:59      阅读:58      评论:0      收藏:0      [点我收藏+]
def is_isbn_or_key(word):

    isbn_or_key=key
    ‘‘‘
    isdigit()方法检测字符串是否只由数字组成。
    ‘‘‘
    if len(word)==13 and word.isdigit():
        isbn_or_key=isbn

    short_word=word.replace(-,‘‘)
    if len(short_word)==10 and short_word.isdigit():
        isbn_or_key=isbn

    return isbn_or_key

 

python 的isdigit()

原文:https://www.cnblogs.com/tangqiu/p/12565853.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!