Python名词单数变换为复数函数

def plural(word):
    if word.endswith(‘y‘):
        return word[:-1]+‘ies‘
    elif word[-1] in ‘sx‘ or word[-2:] in [‘sh‘,‘ch‘]:
        return word+‘es‘
    elif word.endwith(‘an‘):
        return word[-2:]+‘en‘
    else:
        return word+‘s‘

Python名词单数变换为复数函数,布布扣,bubuko.com

Python名词单数变换为复数函数

上一篇:[Java][MyBatis]物理分页实现


下一篇:npm安装报错整理 npm ERR! network proxy config is set properly See npm help config getaddrinfo EN