笨办法学python中笔记

转义字符的作用:

一、Program1:print "I am 6'2\"tall." # 将字符串中的双引号转义

Result1: I am 6'2"tall.

Program2: print 'I am 6\'2" tall'. # 将字符串中的单引号转义

Result2:I am 6'2"tall.

二、各种转义字符https://blog.csdn.net/wowocpp/article/details/79497719

三、python中%r和%s的区别

https://blog.csdn.net/wusuopubupt/article/details/23678291

四、input 和raw_input 的区别

http://www.runoob.com/python/python-func-raw_input.html

在 Python2.x 中 raw_input( ) 和 input( ),两个函数都存在,其中区别为: raw_input( ) 将所有输入作为字符串看待,返回字符串类型。 input( ) 只能接收“数字”的输入,在对待纯数字输入时具有自己的特性,它返回所输入的数字的类型( int, float )。

在 Python3.x 中 raw_input( ) 和 input( ) 进行了整合,去除了 raw_input( ),仅保留了 input( ) 函数,其接收任意任性输入,将所有输入默认为字符串处理,并返回字符串类型。

五、习题37 复习各种符号

Keywords

关键词

含义或用法

and

逻辑连接判断词

del

删除变量,不是删除数据https://blog.csdn.net/qq_34941023/article/details/52918329

from

导入某库

not

逻辑连接判断词

while

循环

as

 跟 with 一起使用 简化代码 处理异常

https://www.cnblogs.com/DswCnblog/p/6126588.html

elif

与 if  一起使用

global

全局函数https://blog.csdn.net/budong282712018/article/details/80236191

or

二取一为真

With

与as 一起使用https://www.ibm.com/developerworks/cn/opensource/os-cn-pythonwith/

assert

assert断言是声明其布尔值必须为真的判定,如果发生异常就说明表达示为假。可以理解assert断言语句为raise-if-not,用来测试表示式,其返回值为假,就会触发异常。http://www.cnblogs.com/liuchunxiao83/p/5298016.html

else

If 用法

Pass

 

Python pass是空语句,是为了保持程序结构的完整性。

pass 不做任何事情,一般用做占位语句。

http://www.runoob.com/python/python-pass-statement.html

Yield

http://www.runoob.com/w3cnote/python-yield-used-analysis.html

break

打破循环http://www.runoob.com/python/python-break-statement.html

Except

异常处理http://www.runoob.com/python/python-exceptions.html

import

引入模组

print

打印

class

https://blog.csdn.net/CityzenOldwang/article/details/78359348

exec

exec语句用来执行储存在字符串或文件中的Python语句。例如,我们可以在运行时生成一个包含Python代码的字符串,然后使用exec语句执行这些语句。下面是一个简单的例子。

>>> exec 'print "Hello World"'
Hello World

http://blog.sina.com.cn/s/blog_76e94d210100w1bl.html

in

在列表 ,数组

raise

引发异常处理https://blog.csdn.net/u014148798/article/details/52288326

continue

Python continue 语句跳出本次循环,而break跳出整个循环。

continue 语句用来告诉Python跳过当前循环的剩余语句,然后继续进行下一轮循环。

continue语句用在while和for循环中。

http://www.runoob.com/python/python-continue-statement.html

finally

异常处理http://www.runoob.com/python/python-exceptions.html

is

 

return

返回值

def

定义函数

for

循环语句

lamba

https://www.cnblogs.com/evening/archive/2012/03/29/2423554.html

 

try

异常处理http://www.runoob.com/python/python-exceptions.html

七、字符串格式化功能https://www.cnblogs.com/zyq-blog/p/5946905.html

 

 

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值