自觉不才,使用def语句时容易出现以下错误, 参考: 习题—25 http://www.2cto.com/shouce/Pythonbbf/ex25.html def add(): print "A true man does what he will, not what he must!" add ...
分类:
其他好文 时间:
2016-06-10 14:52:41
阅读次数:
141
Map函数: 原型:map(function, sequence),作用是将一个列表映射到另一个列表, 使用方法: def f(x): return x**2 l = range(1,10) map(f,l) Out[3]: [1, 4, 9, 16, 25, 36, 49, 64, 81] Red ...
分类:
编程语言 时间:
2016-06-10 12:15:47
阅读次数:
196
windows_21_Library_Variable_DLL&&CPP&&DEF 动态库补充6 CPP//第二步,增加导出声明__declspec( dllexport )/*增加导出声明*///第一步,定义全局变量int g_nValue1 = 100; // global Variable//... ...
windows_21_Library_DLL_test&&CPP&&DEF 动态库补充3 //1.1 创建DLL的项目//1.2 增加动态库函数__declspec( dllexport ) //C++导出方式int Dll_Add( int nAdd1, int nAdd2 ){ return n... ...
def Function(args): print args print apply(Function,'aaa') #apply 是用来执行函数的 #!coding:utf-8 assert(1==1)#取值相等则往下走 print 'aaa' def foo(*arg): for item in ...
分类:
编程语言 时间:
2016-06-10 06:16:38
阅读次数:
262
最长递增子子序列,这是动态规划里的经典问题了。 python代码如下 def get_max_increase_sequence1(a): # dp[i] = max{dp[j] | 0<=j<i,a[i]<a[j] } + 1 # O(n**2) num=len(a) dp=[0]*num for ...
分类:
编程语言 时间:
2016-06-10 06:10:36
阅读次数:
1358
这个程序的核心内容就是def语句,if语句和while语句循环的重复使用。 参考: 习题—35 # coding: utf-8def dead(why): # 定义dead函数,exit()可用于退出循环 print why, 'YOU DEAD!' # exit(0) 表示正常退出,exit(1) ...
分类:
其他好文 时间:
2016-06-09 22:09:23
阅读次数:
183
1.创建一个类 class Employee: empCount = 0 def __init__(self,name,salary): self.name = name self.salary = salary Employee.empCount +=1 def displayEmployee(s... ...
分类:
编程语言 时间:
2016-06-09 18:29:01
阅读次数:
233
# py1.py# -*- coding: utf-8 -*- import sqlalchemy import tushare import pandas import socket import struct class Mysql0: def __init__(self, user0='tes... ...
分类:
数据库 时间:
2016-06-09 17:11:11
阅读次数:
271
1.介绍 函数代码块以def关键字开头,后接函数标识符名称和圆括号; return[表达式]结束函数,不带表达式的return,默认返回None 2.函数的简单调用 def printme(str): print str return printme(11) 3.传递参数 所有参数在Python里都... ...
分类:
编程语言 时间:
2016-06-09 12:14:51
阅读次数:
371