随笔分类 -  python笔记

摘要:匹配手机号: 1 phone_str = "hey my name is alex, and my phone number is 13651054607, please call me if you are pretty!" 2 phone_str2 = "hey my name is alex, 阅读全文
posted @ 2018-10-18 10:35 子觉 阅读(424) 评论(0) 推荐(0)
摘要:描述 Python strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。 注意:该方法只能删除开头或是结尾的字符,不能删除中间部分的字符。 Example: #!/usr/bin/python # -*- coding: UTF-8 -*- str = "0000000 阅读全文
posted @ 2018-10-16 12:03 子觉 阅读(217) 评论(0) 推荐(0)
摘要:下面由三个长度为 4 的列表组成的 3x4 矩阵: >>> matrix = [ ... [1, 2, 3, 4], ... [5, 6, 7, 8], ... [9, 10, 11, 12], ... ] 下面的列表推导式将转置行和列: >>> [[row[i] for row in matrix 阅读全文
posted @ 2018-10-15 17:36 子觉 阅读(800) 评论(0) 推荐(0)