摘要: 基本操作: 索引 index, 切片通过[:]实现 追加 append单;extend多,insert 删除pop,remove,clear 长度len,count 循环for i in list 包含copy ls.append(object) #向列表中插入元素,但每次只能插入一个 ls.cou 阅读全文
posted @ 2017-03-20 22:40 Leon_online 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 字符串常用功能: 移除空白 strip,lstrip,rstrip, 分割 spilt,partition & rpartition 长度 len 索引 index,find,rfind 切片 [:]来实现 移除空白 strip,lstrip,rstrip, 分割 spilt,partition & 阅读全文
posted @ 2017-03-20 22:26 Leon_online 阅读(163) 评论(0) 推荐(0) 编辑
摘要: #! /usr/bin/env pythoncount = 0for i in range(1000,3000): set = str (i) if (set[::-1]) == (set[0::]): count += 1 print(i,"count=",count)#第二种方法# def fn 阅读全文
posted @ 2017-03-13 15:37 Leon_online 阅读(325) 评论(0) 推荐(0) 编辑
摘要: Python格式化输出 1.通过指定的数据类型输入 #! /usr/bin/env python name = input("Name:") age = input("Age:") sex = input("Sex:") info = ''' Info-of-%s Name=%s Age=%s Se 阅读全文
posted @ 2017-03-03 10:35 Leon_online 阅读(176) 评论(1) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2017-02-28 21:21 Leon_online 阅读(2) 评论(0) 推荐(0) 编辑