Python 符号 自学总结(学习中)
来源:互联网 发布:方舟生存进化画面优化 编辑:程序博客网 时间:2024/06/16 09:19
(一)关键字
①逻辑符号 and,not or
**And**1 and 1 #Trueif (1 and zero) #下列语句不执行 .......**Not**1.a = Falseif not a print "You did it" 2.a = 20b = [1 2 4 8 16 32]if a not in b print "We can't find a in b." **or**1 or 0 #True
② del
a = 5b = a del aprint (b) #del函数只是删除了变量,并没有删除数据
③from, import
from sys import .... #目前只学到了这个用法,从某处导入……import #导入
④while
while(expression): excute....... #循环,当!expression时退出
⑤as
import some as other #some为库函数,但调用时不想直接用其名字,可as为other,使用时直接调用other,作用同some
⑥if elif else
if (expression): ..........elif (expression): ..........else (expression): .......... #三者表达式写法相近,if 一定要有
⑦global
a = 10def something(): global a a = 20 print "Here a = %d\n" %aprint "We can see a now is %d\n" %asomething()print "Now the a is %d" %a
#这里代码运行结果如下We can see a now is 10Here a = 20Now the a is 20
⑧ with(待更新)
⑨assert(待更新)
⑩pass
if (expression) pass #暂时跳过
⑪yield(待更新)
⑫except(待更新)
⑬class(待更新)
⑭exec(待更新)
⑮
⑯
⑰
⑱
⑲
⑳
自学起步,写此博客作为总结及查缺补漏用,如果各位dalao发现博客里的错误,欢迎纠正。谢谢!
阅读全文
0 0
- Python 符号 自学总结(学习中)
- python 自学总结
- python自学总结
- python 学习中总结
- python中%符号详解
- python中%符号详解
- android NDK学习。。。自学总结
- Python学习笔记之符号
- Python中字符串格式化符号
- Python自学之函数参数总结
- python学习(一)----os模块中常用方法总结
- JavaScript学习总结(二)值得比较的符号
- 视频学习笔记-自学Python day1
- python自学笔记(一)
- python自学笔记(一)
- Python自学(一):概述
- pixhawk自学笔记之uorb学习总结
- pixhawk自学笔记之uorb学习总结
- 匿名内部类是什么?为什么其访问外部变量必须是finally的?
- Codeforces 861 D. Polycarp's phone book (trie)
- Lintcode137 Clone Graph solution 题解
- 隐藏/显示左frame栏
- 浅析web Storage
- Python 符号 自学总结(学习中)
- Find K Min
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 I. Barty's Computer(哈希||字典树)
- Centos安装redis
- poj3352 Road Construction 边双连通分量tarjan算法
- Nginx的优缺点
- 塔防类游戏如何绘制网格地图 (OnDrawGizmos())
- ubuntu16.04 安装jre
- SublimeText3最新版注册码