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
原文:http://blog.csdn.net/guoqingchun/article/details/23350925