_function.py
来源:互联网 发布:mysql查询性能分析器 编辑:程序博客网 时间:2024/06/06 00:34
com.farmer.sample
_function.py
'''
Created on 2014-10-22
@author: XSD
# function #
NOTE:Encoding=UTF-8
'''
#!/usr/bin/env python 3.4.2
'''
def has_record():
"""This is a function to find the record"""
try:
rec = data[num]
except KeyError:
rec = 0
return rec
'''
def has_record(data, num='a'):
"""This is a function to find the record"""
if type(data) != type({}):
print('error param data', data)
try:
rec = data[num]
except KeyError:
rec = 0
return rec
def ret_obj(param):
"""This is a function to return result"""
if type(param) != type(''):
print('error param ', param)
try:
data = {'a':21, 'b':0, 'c':2}
res = has_record(data, param)
except KeyError:
res = 0
return res
def nest_structure_fun(opt):
"""This is a nested function"""
optionDic = set()
def fir_realize(len):
"""This is a inner function"""
if type(len) != type(0) or len < 1:
raise print('error param:', len)
for i in range(len):
optionDic.add('o' + str(i))
else:print('loading')
if opt == 'a':
fir_realize(3)
elif opt == 'b':
fir_realize(4)
else:
fir_realize(5)
return optionDic
_function.py
'''
Created on 2014-10-22
@author: XSD
# function #
NOTE:Encoding=UTF-8
'''
#!/usr/bin/env python 3.4.2
'''
def has_record():
"""This is a function to find the record"""
try:
rec = data[num]
except KeyError:
rec = 0
return rec
'''
def has_record(data, num='a'):
"""This is a function to find the record"""
if type(data) != type({}):
print('error param data', data)
try:
rec = data[num]
except KeyError:
rec = 0
return rec
def ret_obj(param):
"""This is a function to return result"""
if type(param) != type(''):
print('error param ', param)
try:
data = {'a':21, 'b':0, 'c':2}
res = has_record(data, param)
except KeyError:
res = 0
return res
def nest_structure_fun(opt):
"""This is a nested function"""
optionDic = set()
def fir_realize(len):
"""This is a inner function"""
if type(len) != type(0) or len < 1:
raise print('error param:', len)
for i in range(len):
optionDic.add('o' + str(i))
else:print('loading')
if opt == 'a':
fir_realize(3)
elif opt == 'b':
fir_realize(4)
else:
fir_realize(5)
return optionDic
0 0
- _function.py
- Note_20150814_C++_Function
- javascript学习笔记_function
- py
- py
- py
- py
- py
- py
- py
- Py
- Let us learn C in Code <5>_printf()_function
- bin2hex.py && hex2bin.py
- web.py (url.py)
- [py]py存放家具
- Xctf之调皮的py-py-py
- dir_size.py
- sendEmail.py
- TT日程管理V2.0开发系列1——经验分享
- GenericUserBasedRecommender推荐引擎源码分析
- 111
- js字符串传参
- [LeetCode] Convert Sorted Array to Binary Search Tree
- _function.py
- Codeforces Round #284 (Div. 2)---A,B,C
- 多个IoC容器适配器设计及性能测试和容器选择
- maven引入jar包
- linux shell数据重定向(输入重定向与输出重定向)详细分析
- UNIX网络编程I-03
- Masonry介绍与使用实践(快速上手Autolayout)
- ECC协议栈学习总结
- 自己动手制作一台四位计算机