tr:nth-child(odd) > td,
.table-striped tbody > tr:nth-child(odd) > th {
background-color: #f9f9f9;
}

.table-celled.table tr td,.table-celled.table tr th {
border-left: 1px solid rgba(34,36,38,.1)
}

.table-celled.table tr td:first-child,.table-celled.table tr th:first-child {
border-left: none
}

.toc ul {
list-style: none;
}
p {
line-height: 1.6;
}
body>p {
margin-bottom: 1.8em;
}
body>p>img.center,
body>p>a>img.center {
display: block;
margin: 0 auto;
background-color: rgba(128,128,128,0.3);
}
body {
font-family: 'Helvetica Neue', helvetica, tahoma, arial, 'Hiragino Sans GB', stheiti, "Microsoft YaHei", "微软雅黑", 'WenQuanYi Micro Hei', stxihei, "华文细黑", heiti, "黑体", simsun, "宋体", song, sans-serif;
font-size: 1.15em;
font-weight: 100;
// line-height: 1.8em;
color: #2f2f2f;
}
em.cjk_emphasis{
font-style: normal;
font-family: georgia,"Times New Roman",times,"楷体","AR PL UKai CN", "NSimSun","Songti SC","SimSun",serif!important;
}
body dt,
body dd {
line-height: 1.35em;
}
body code, body .xiaoshujiang_code {
// background-color: #D6DBDF;
border: 0;
border-radius: 4px;
// color: #2C3E50;
font-size: 90%;
// padding: 2px 4px;
}
code {
background-color: #d6dbdf;
border-radius: 4px;
color: #2c3e50;
padding: 2px 4px;
}
.xiaoshujiang_code ol{
margin-bottom: 0px;
}
body h1 {
line-height: 1.6;
}
body h2 {
line-hieght: 1.1;
}
body h3 {
line-height: 1.1;
}

/**
* Treeview syntax highlighting based on highlight.js
* Copyright (c) 2014-2015, Asciidocfx Team, (MIT Licensed)
* https://github.com/asciidocfx/highlight-treeview.js
*/
.language-treeview.hljs{
position: relative;
}
.hljs-folder,
.hljs-hiddenfile,
.hljs-file {
position: relative;
vertical-align: top;
display: inline-block;
height: 16px;
}
.hljs-folder:before,
.hljs-file:before,
.hljs-hiddenfile:before {
top: 0;
content: '';
width: 14px;
height: 12px;
margin-top: 0px;
margin-right: 3px;
position: relative;
display: inline-block;
background-size: 14px;
background-repeat: no-repeat;
}
.hljs-file:before,
.hljs-hiddenfile:before {
height: 14px;
margin-left: 1px;
}
.hljs-hiddenfile {
opacity: 0.6;
}
.hljs-file.photo:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f1c5";
}
.hljs-file.plain:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f016";
}
.hljs-file.source:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f1c9";
}
.hljs-file.archive:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f1c6";
}
.hljs-file.audio:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f1c7";
}
.hljs-file.video:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f1c8";
}
.hljs-file.pdf:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f1c1";
}
.hljs-file.xls:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f1c3";
}
.hljs-file.doc:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f1c2";
}
.hljs-file.ppt:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f1c4";
}
.hljs-folder:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f114";
}
.hljs-hiddenfile:before {
font: normal normal normal 14px/1 fontawesome;
content: "\f016";
}
.hljs-tvline {
margin-left: 6px;
position: absolute;
text-indent: -99em;
padding-bottom: 8px;
vertical-align: top;
display: inline-block;
border-left-width: 1px;
border-left-style: solid;
border-left-color: rgb(94, 144, 117);
}
.hljs-folder-branch {
width: 8px;
height: 8px;
margin-top: -1px;
margin-left: 6px;
text-indent: -99em;
position: relative;
vertical-align: top;
display: inline-block;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: rgb(94, 144, 117);
}
.hljs-folder-branch.win {
width: 14px;
margin-right: 2px;
}
.hljs-folder-last-branch {
height: 7px;
width: 7px;
margin-left: 6px;
text-indent: -99em;
position: relative;
vertical-align: top;
display: inline-block;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: rgb(94, 144, 117);
border-left-width: 1px;
border-left-style: solid;
border-left-color: rgb(94, 144, 117);
}
.hljs-folder-last-branch.win {
width: 13px;
margin-right: 2px;
}

/**
* Treeview syntax highlighting based on highlight.js
*/

.mark{
border: 0;
background-color: #ddf3e7;
border-radius: 4px;
color: #29754d;
font-size: 90%;
padding: 2px 4px;
}
.line_mark{
border: 1px dashed #3a4c42;
}
code .mark, .xiaoshujiang_code .mark{
border-radius: 0px;
font-size: initial;
padding: initial;
}
a.attachment{
background-color: #ecf0f3;
border: 1px solid #bec6cb;
display: inline-block;
padding: 5px;
margin: 2px;
min-width: 250px;
}
a.attachment i.fa{
font-size: 3em;
float: left;
margin-right: 0.2em;
}
a.attachment .filename{
vertical-align: top;
text-align: left;
font-weight: bold;
}
a.attachment .filesize{
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
opacity: .6;
font-size: 80%;
white-space: nowrap;
}
.checkbox .checked{
text-decoration: line-through;
}
.flow-chart, .sequence-diagram{
text-align: center;
}
.plot, .plot-image{
text-align: center;
min-height: 200px;
min-width: 200px;
}

pre, .xiaoshujiang_pre {
line-height: initial !important;
word-wrap: break-word;
word-break: break-word;
}

.xiaoshujiang_pre {
margin: 1em 0px;
font-family: monospace;
white-space: pre;
}

.story_align_left, .story_align_left .story_image_container {
text-align: left;
}
.story_align_right, .story_align_right .story_image_container {
text-align: right;
}
.story_align_center, .story_align_center .story_image_container {
text-align: center;
}
.story_align_justify, .story_align_justify .story_image_container {
text-align: justify;
}

/**
* code line nums
*/
code.hljs.code_linenums, .xiaoshujiang_code.hljs.code_linenums{
position: relative;
}
.ol_linenums{
padding: 0px;
margin-left: 30px;
border-left: 1px solid #e0e0e0;
}
.li_linenum{
line-height: 20px;
margin-left: 10px;
list-style: none;
counter-increment: lines 1;
}
.li_linenum.li_list_style{
list-style: inherit;
margin-left: 5px;
}
.li_linenum:before, .li_linenum_before_span{
content: counter(lines, decimal);
position: absolute;
left: 0px;
text-align: center;
width: 2.5em;
opacity: 0.5;
vertical-align: top;
}
.li_linenum_before_span_hide{
display: none;
}
.xiaoshujiang_code .code_line_break_hack{
margin:0;
border:0;
border-top:0;
border-bottom:0;
}
/**
* code line nums
*/
.mathjax-container{
text-align: center;
}
div.mathjax{
max-width: 700px;
margin: 0 auto;
font-size: 14px;
}
text{
font-size: 14px;
}

/**
* block image
*/

.story_image_container{
text-align: center;
}
.story_image_container>.story_image{
display: inline-block;
position: relative;
max-width: 80%;
}
.story_image_caption{
border-bottom: 1px solid #d9d9d9;
display: inline-block;
color: #999;
padding: 10px;
}
.story_image_blank_caption{
border-bottom: 0px;
}
/**
.story_image:before, .story_image:after{
content: '';
position: absolute;
z-index: -2;
bottom: 13px;
left: 10px;
width: 50%;
height: 20%;
border-radius: 10px/90px;
box-shadow: 0 15px 10px rgba(0,0,0,0.7);
-webkit-transform: rotate(-3deg);
-moz-transform: rotate(-3deg);
-ms-transform: rotate(-3deg);
-o-transform: rotate(-3deg);
transform: rotate(-3deg);
}
.story_image:after {
right: 10px;
left: auto;
-webkit-transform: rotate(3deg);
-moz-transform: rotate(3deg);
-ms-transform: rotate(3deg);
-o-transform: rotate(3deg);
transform: rotate(3deg);
}

**/
.story_image>img{
border-radius: 0.3125em;
box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.08);
}
.story_inline_image>img{
max-width: 50%;
vertical-align: bottom;
}
.story_remote_resource_block{
text-align: center;
}
.xiaoshujiang_code_container {
position: relative;
padding-bottom: 2em;
}

.xiaoshujiang_code_title_container{
font-size: 70%;
opacity: 0.5;
}
.xiaoshujiang_code_title_container>.xiaoshujiang_code_infos{
float: right;
}

/*

Visual Studio-like style based on original C# coloring by Jason Diamond

*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: white;
color: black;
-webkit-text-size-adjust: none;
}

.hljs-comment,
.hljs-annotation,
.diff .hljs-header,
.hljs-chunk,
.apache .hljs-cbracket {
color: #008000;
}

.hljs-keyword,
.hljs-id,
.hljs-built_in,.css
.smalltalk .hljs-class,
.hljs-winutils,
.bash .hljs-variable,
.tex .hljs-command,
.hljs-request,
.hljs-status,
.nginx .hljs-title,
.xml .hljs-tag,
.xml .hljs-tag .hljs-value {
color: #00f;
}

.hljs-string,
.hljs-title,
.hljs-parent,
.hljs-tag .hljs-value,
.hljs-rule .hljs-value,
.ruby .hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.hljs-template_tag,
.django .hljs-variable,
.hljs-addition,
.hljs-flow,
.hljs-stream,
.apache .hljs-tag,
.hljs-date,
.tex .hljs-formula,
.coffeescript .hljs-attribute,
.hljs-name {
color: #a31515;
}

.ruby .hljs-string,
.hljs-decorator,
.hljs-filter .hljs-argument,
.hljs-localvars,
.hljs-array,
.hljs-attr_selector,
.hljs-pseudo,
.hljs-pi,
.hljs-doctype,
.hljs-deletion,
.hljs-envvar,
.hljs-shebang,
.hljs-preprocessor,
.hljs-pragma,
.usertype,
.apache .hljs-sqbracket,
.nginx .hljs-built_in,
.tex .hljs-special,
.hljs-prompt {
color: #2b91af;
}

.hljs-phpdoc,
.hljs-dartdoc,
.hljs-javadoc,
.hljs-xmldoctag {
color: #808080;
}

.hljs-type,
.hljs-typename { font-weight: bold; }

.vhdl .hljs-string { color: #666666; }
.vhdl .hljs-literal { color: #a31515; }
.vhdl .hljs-attribute { color: #00b0e8; }

.xml .hljs-attribute { color: #f00; }
-->

1.内置函数补充

callable(object)
检查对象object是否可调用
1、类是可以被调用的
2、实例是不可以被调用的,除非类中声明了__call__方法

def f1():
print("test") f2 = "test" print(callable(f1))
print(callable(f2))
True
False

chr(i)
返回整数i对应的ASCII字符

print(chr(81))

print(chr(81))

odr(c)
参数c是一个ascii字符,返回值是对应的十进制整

print (ord('b'))

print (ord('b'))

随机验证码

import random
li = []
for i in range(5):
temp = random.randrange(65,91)
c = chr(temp)
li.append(c) result = "".join(li)
print(result)
 

compile(source, filename, mode[, flags[, dont_inherit]])
将source编译为代码或者AST对象。代码对象能够通过exec语句来执...
compile(source, filename, mode[, flags[, dont_inherit]])
中文说明:将source编译为代码或者AST对象。代码对象能够通过exec语句来执行或者eval()进行求值。
参数source:字符串或者AST(Abstract Syntax Trees)对象。
参数 filename:代码文件名称,如果不是从文件读取代码则传递一些可辨认的值。
参数model:指定编译代码的种类。可以指定为 ‘exec’,’eval’,’single’。
参数flag和dont_inherit:这两个参数暂不介绍,可选参数。

版本:在python2.3、2.6、2.7、3.2中均有不同,使用时要引起注意,兼容python3

英文说明:

Compile the source into a code or AST object. Code objects can be executed by an exec statement or evaluated by a call to eval(). source can either be a string or an AST object. Refer to the ast module documentation for information on how to work with AST objects.
The filename argument should give the file from which the code was read; pass some recognizable value if it wasn’t read from a file ('' is commonly used).
The mode argument specifies what kind of code must be compiled; it can be 'exec' if source consists of a sequence of statements, 'eval' if it consists of a single expression, or 'single' if it consists of a single interactive statement (in the latter case, expression statements that evaluate to something other than None will be printed).
The optional arguments flags and dont_inherit control which future statements (see PEP 236) affect the compilation of source. If neither is present (or both are zero) the code is compiled with those future statements that are in effect in the code that is calling compile. If the flags argument is given and dont_inherit is not (or is zero) then the future statements specified by the flags argument are used in addition to those that would be used anyway. If dont_inherit is a non-zero integer then the flags argument is it – the future statements in effect around the call to compile are ignored.
Future statements are specified by bits which can be bitwise ORed together to specify multiple statements. The bitfield required to specify a given feature can be found as the compiler_flag attribute on the _Feature instance in the future module.
This function raises SyntaxError if the compiled source is invalid, and TypeError if the source contains null bytes.
Note When compiling a string with multi-line code in 'single' or 'eval' mode, input must be terminated by at least one newline character. This is to facilitate detection of incomplete and complete statements in the code module.
Changed in version 2.3: The flags and dont_inherit arguments were added.
Changed in version 2.6: Support for compiling AST objects.
Changed in version 2.7: Allowed use of Windows and Mac newlines. Also input in 'exec' mode does not have to end in a newline anymore.

exec(r)
执行python代码,接收:代码或者字符串

exec(print("test"))

eval(s)
执行表达式,并且获取结果

eval(7*8)

dir(class)
快速查看,对象提供了哪些功能

dir(dict)

help(class)
获取帮助

help(dict)

divmod(d,d)
共:97,每页显示10条,需要多少页

n1 n2 = divmod(97, 10)

isinstance(instance,class)
用于判断,对象是否是类的实例

s = "test"
print(isinstance(s, str))

filter(函数, 可迭代对象)
循环第二个参数,让每个循环元素执行函数,如果函数返回值为True,则元素是合法的。

li = [ 1, 2, 3, 4 ]
ret = filter(None, li)
print(list(ret))

lamda()
默认返回结果为返回值

map(函数,可迭代的对象(可以for循环的东西))
可迭代对象每个元素应用到函数中,返回结果为列表。

filter()     #函数返回True,将元素添加到结果中
map()     #将函数返回值添加到结果中

globals()
所有的全局变量
locals()
所有的局部变量

hash(s)
转换成hash值,一般用于字典的key

len(s)
返回一个对象的长度

s = "字符"
print(len(s))
b = bytes(s, encoding = "utf-8")
print(len(b))

max([list])
返回列表中的最大值

li = [11, 22, 33]
r = max([li])

zip()
将列表的每列值组成一个无组

x = [1, 2, 3]
y = [4, 5, 6]
z = [7, 8, 9]
xyz = zip(x, y, z)
print xyz
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]

2.Alex鸡汤

推荐书:《林达看美国》

json.loads(s)
将一个字符串,转换成python的基本数据类型,字符串形式的字典必须是双引号引用key value

3.装饰器

装饰器,我的理解是在不影响原函数的情况下(包括执行过程,返回结果,返回值等),增加其它功能(原函数前或后),即达到在不修改原代码的前提下,实现增加的功能。

所以,其优点有:

1.代码修改量小,不影响原函数内部逻辑等;

2.不修改原函数代码,避免原功能因代码语法性错误;

3.灵活性强,在需要增加功能的函数前加简单代码就行;

#def outer(func):
# print(123,func)
#def outer(func):
# return "111"
def outer(func):
def inner(*args,**kwargs): #支持不定传参
print("before")
r = func(*args,**kwargs) #返回原函数返回值
return r #返回原函数返回值
print("after")
return inner # @ + 函数名
# 功能:
# 1. 自动执行outer函数并且将其下面的函数名f1当作参数传递
# 2. 将outer函数的返回值,重新赋值给f1 @outerdef f1():
print("F1")

Python学习记录day4的更多相关文章

  1. Python学习记录day6

    title: Python学习记录day6 tags: python author: Chinge Yang date: 2016-12-03 --- Python学习记录day6 @(学习)[pyt ...

  2. Python学习记录day5

    title: Python学习记录day5 tags: python author: Chinge Yang date: 2016-11-26 --- 1.多层装饰器 多层装饰器的原理是,装饰器装饰函 ...

  3. Python学习记录day8

    目录 Python学习记录day8 1. 静态方法 2. 类方法 3. 属性方法 4. 类的特殊成员方法 4.1 __doc__表示类的描述信息 4.2 __module__ 和 __class__ ...

  4. Python学习记录day7

    目录 Python学习记录day7 1. 面向过程 VS 面向对象 编程范式 2. 面向对象特性 3. 类的定义.构造函数和公有属性 4. 类的析构函数 5. 类的继承 6. 经典类vs新式类 7. ...

  5. Python学习记录:括号配对检测问题

    Python学习记录:括号配对检测问题 一.问题描述 在练习Python程序题的时候,我遇到了括号配对检测问题. 问题描述:提示用户输入一行字符串,其中可能包括小括号 (),请检查小括号是否配对正确, ...

  6. 实验楼Python学习记录_挑战字符串操作

    自我学习记录 Python3 挑战实验 -- 字符串操作 目标 在/home/shiyanlou/Code创建一个 名为 FindDigits.py 的Python 脚本,请读取一串字符串并且把其中所 ...

  7. 我的Python学习记录

    Python日期时间处理:time模块.datetime模块 Python提供了两个标准日期时间处理模块:--time.datetime模块. 那么,这两个模块的功能有什么相同和共同之处呢? 一般来说 ...

  8. Python 学习记录

    记录一些 学习python 的过程 -------------------------------------- 1. 初始学习 @2013年10月6日 今天开始学习python 了 遇到好多困难但是 ...

  9. python学习记录_IPython基础,Tab自动完成,内省,%run命令_

        这是我第一次写博客,之前也有很多想法,想把自己所接触的,以文本的形式储存,总是没有及时行动.此次下定决心,想把自己所学,所遇到的问题做个记录共享给诸位,与此同时自己作为备忘,感谢各位访问我的博 ...

随机推荐

  1. Java基础学习 -- 异常

    当异常发生时,原本要接着执行的代码不再执行,转而让其他部分的代码来处理.如果没有代码负责处理,控制台会报告异常. 异常出现时的执行机制: 异常机制最大的好处是:清晰地分开了 正常的业务逻辑 和 遇到情 ...

  2. slidedoor滑动门特效

    slidedoor滑动门特效 exportWidth:暴露门的宽度 width imagesWidth:单张图片的宽度width 每道门每次偏移量 translate=imagesWidth-expo ...

  3. jQuery带tab切换搜索框样式代码

    效果体验:http://hovertree.com/texiao/jquery/23/ 代码如下,保存到HTML文件也可以查看效果: <!DOCTYPE html> <html la ...

  4. HTML 定时页面跳转

    有 2 种方法可以实现 html 的定时页面跳转,1.meta refresh 实现.2.JavaScript 实现. 1.通过 meta refresh 实现 3 秒后自动跳转到 http://ww ...

  5. 深入理解Javascript中构造函数和原型对象的区别

    在 Javascript中prototype属性的详解 这篇文章中,详细介绍了构造函数的缺点以及原型(prototype),原型链(prototype chain),构造函数(constructor) ...

  6. mfc学习之路--如何删除通过控件新增的变量

    刚刚学校mfc的人都会遇到这样一个问题(比如我),在照做书做一个mfc程序,给控件新增变量时变量类型错了,但是变量名对了,然后想要加个正确的时候提示"已经存在该对象",然后就傻了, ...

  7. js数组中数字从小到大排列

    function findMin(start,arr){ var iMin = 99999; var iMinIndex = -1; for(var i = start;i<arr.length ...

  8. 理解CSV文件以及ABAP中的相关操作

    在很多ABAP开发中,我们使用CSV文件,有时候,关于CSV文件本身的一些问题使人迷惑.它仅仅是一种被逗号分割的文本文档吗? 让我们先来看看接下来可能要处理的几个相关组件的词汇的语义. Separat ...

  9. 关于印发利用DEM确定耕地坡度分级技术规定(试行)的通知

    下载:http://files.cnblogs.com/files/gisoracle/%E5%88%A9%E7%94%A8DEM%E7%A1%AE%E5%AE%9A%E8%80%95%E5%9C%B ...

  10. 【转】Linux 初始化 init 系统 [sysvinit systemd upstart]

    http://www.ibm.com/developerworks/cn/views/linux/libraryview.jsp?sort_by=&show_abstract=true& ...