安迪_963

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 9 10 11 12 13 14 下一页

2016年3月25日

摘要: filter(function or None, iterable) --> filter object Return an iterator yielding those items of iterable for which function(item) is true. If function 阅读全文
posted @ 2016-03-25 20:45 Andy_963 阅读(524) 评论(0) 推荐(0) 编辑

2016年3月24日

摘要: 有一列表,某一元素在列表中出现多次,要求求出该元素在列表中的索引位置。 最简单的方案就是直接对所有元素进行遍历。这里不考虑。 1 # coding:utf-8 2 name = list('12345242523552623623') 3 4 first_pos = 0 5 for i in ran 阅读全文
posted @ 2016-03-24 15:52 Andy_963 阅读(684) 评论(0) 推荐(0) 编辑

2016年3月23日

摘要: 要求,从用户处得到一个数,打印直到该数,并让用户选择是否继续。如果此数已经输出,则提示过了,并要求再次输入。 阅读全文
posted @ 2016-03-23 18:17 Andy_963 阅读(295) 评论(0) 推荐(0) 编辑

2016年3月22日

摘要: 1 import urllib.request 2 import re 3 import random 4 5 def get_source(key): 6 7 print('请稍等,爬取中....') 8 headers = [{'User-Agent':'Mozilla/5.0 (Windows 阅读全文
posted @ 2016-03-22 08:15 Andy_963 阅读(5695) 评论(2) 推荐(0) 编辑

2016年3月2日

摘要: 1 #python 字典实现类似c的switch 2 3 def print_hi(): 4 print('hi') 5 6 def print_hello(): 7 print('hello') 8 9 def print_goodbye(): 10 print('goodbye') 11 12 choice = int(input('plea... 阅读全文
posted @ 2016-03-02 14:25 Andy_963 阅读(573) 评论(0) 推荐(0) 编辑

摘要: 具体区别看下面例子 阅读全文
posted @ 2016-03-02 14:03 Andy_963 阅读(436) 评论(0) 推荐(0) 编辑

2016年2月26日

摘要: python里的赋值都是引用,第一次赋值就是定义。 看下面两个交换值的例子: 1. 2. 初一看,很奇怪,这两种交换怎么会不一样呢? 简单点理解就是第一种是按顺序交换,但第2种是同时交换。 python的这种引用机制类似于c语言的指针。 a = 1 即a 引用1 这个值(a指向1) 情境1:a,b, 阅读全文
posted @ 2016-02-26 16:57 Andy_963 阅读(1293) 评论(0) 推荐(1) 编辑

2016年2月18日

摘要: 这里通过 映射操作符'**'将当前还在操作范围内的element,number传递给函数locals() 阅读全文
posted @ 2016-02-18 18:09 Andy_963 阅读(237) 评论(0) 推荐(0) 编辑

2016年2月13日

摘要: 已实现基本功能,显示行号功能暂时实现不了(后面学会了再加,右下角可以实现定位光标所在行.列) 可能会有些bug 1 from tkinter import * 2 from tkinter.messagebox import * 3 from tkinter.filedialog import * 4 from threading import Timer 5 import s... 阅读全文
posted @ 2016-02-13 12:57 Andy_963 阅读(805) 评论(0) 推荐(0) 编辑

2016年1月26日

摘要: 1 #coding=utf-8 2 class Fruit:#定义一个类 3 def __init__(self,color): 4 self.color=color 5 print("fruit's color:' %s" % self.color) 6 7 def grow(self): 8 p... 阅读全文
posted @ 2016-01-26 14:56 Andy_963 阅读(261) 评论(0) 推荐(0) 编辑

上一页 1 ··· 9 10 11 12 13 14 下一页