1.冒泡排序,相邻位置比较大小,将比较大的(或小的)交换位置 def maopao(a): for i in range(0,len(a)): for j in range(0,len(a)-i-1): if a[j]>a[j+1]: temp = a[j+1] a[j+1] = a[j] a[j] = temp #pri
这是本人在学习python过程中总结的一些关于字符串的常用的方法. 文中引用了python3.5版本内置的帮助文档,大致进行翻译,并添加了几个小实验. isalnum S.isalnum() -> bool #字符串里所有的字符都是字母或者数字时返回True,否则返回False Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.