Python Notes
来源:互联网 发布:小学生网络学校 编辑:程序博客网 时间:2024/06/08 02:59
1."Ryan".lower() which will return "ryan".
2. print "The %s who %s %s!" % ("Knights","say","Ni")
prints "The Knights who say Ni!"
3. Boolean operators aren't just evaluated from left to right. Just like with arithmetic operators, there's an order of operations for boolean operators:not
is evaluated first;and
is evaluated next;or
is evaluated last.
For example, True or not False andFalse
returns True
.
4. String.isalpha()
5. an empty list is just[]
6.
if x not in range(8) or \ y not in range(3): print "Outside the range"
The example above checks if either x
ory
are outside those ranges. The\
character just continues theif
statement onto the next line.
7. "UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position xxx ordinal not in .."
import sys reload(sys) sys.setdefaultencoding('utf8')
8. 执行系统命令
import osprint os.system('ping www.pythontab.com')
9.ImportError: cannot import name Flask
文件名不要和模块重复(flask.py)
0 0
- Python Notes
- Python notes
- Python Notes
- python notes
- Python notes
- Python Notes
- Python Notes
- Python Notes
- python notes
- python-notes
- Python Notes
- Python Cookbook Notes Chapter1
- Python Reviewing Notes
- My python/java notes
- Notes on Python
- Core Python Notes
- Python Technical Notes
- [-]boost python notes
- 回溯法---n皇后问题
- Java编程思想——第七章
- 机器学习练习之逻辑斯谛回归和牛顿方法
- JAVA帮助文档全系列 JDK1.5 JDK1.6 JDK1.7 官方中英完整版下载
- 有n个数,使前面各数顺序向后移动m个位置,最后m个数变成最前面m个数。
- Python Notes
- ZOJ3197
- Oracle 10g RAC的启动和关闭步骤
- Web安全
- Java SE 6 新特性: JMX 与系统管理
- fastdfs errno: 99, error info: Cannot assign requested address
- 基础集成平台开发(系统编码生成方案)
- MAC Apache 自定义目录权限设置
- telnet: connect to address 127.0.0.1: Connection refused