python学习笔记
来源:互联网 发布:各类化验单制作软件 编辑:程序博客网 时间:2024/04/30 02:24
python是完全面向对象语言
字符串
自然字符串: 如果你想要指示某些不需要如转义符那样的特别处理的字符串,那么你需要指定一个自然字符串。自然字符串通过给字符串加上前缀r
或R
来指定。例如r"Newlines are indicated by \n"
。
# FILENAME : 2.pyi = 5print ii=i+1;print i;s='''this is a multi-line string.this is the second line.'''print sq='''this is a multi-line string.\this is the second line.'''print q输出:
jiao.geng@jiaogeng-Latitude-E5450:~/python$ python 2.py 56this is a multi-line string.this is the second line.this is a multi-line string.this is the second line.
使用if语句
#!/usr/bin/python# Filename: if.pynumber = 23guess = int(raw_input('Enter an integer : '))if guess == number: print 'Congratulations, you guessed it.' # New block starts here print "(but you do not win any prizes!)" # New block ends hereelif guess < number: print 'No, it is a little higher than that' # Another block # You can do whatever you want in a block ...else: print 'No, it is a little lower than that' # you must have guess > number to reach hereprint 'Done'# This last statement is always executed, after the if statement is executed输出:
$ python if.py
Enter an integer : 50
No, it is a little lower than that
Done
$ python if.py
Enter an integer : 22
No, it is a little higher than that
Done
$ python if.py
Enter an integer : 23
Congratulations, you guessed it.
(but you do not win any prizes!)
Done
0 0
- 【python】:python学习笔记
- Python学习笔记-Python起步
- Python学习笔记-Python基础
- Python学习笔记-Python对象
- Python基本概念--Python学习笔记
- Python学习笔记:Python函数
- python学习笔记-python安装
- Python学习笔记--Python基础
- 【Python】python基础学习笔记
- python学习笔记3
- Python学习笔记
- Boost.Python学习笔记
- python学习笔记1
- python学习笔记2
- python学习笔记(2)
- Python学习笔记 Module
- Python学习笔记.
- python学习笔记(1)
- Activity 启动模式以及Inent Flags理解
- linux Web服务程序监控shell脚本
- [leetcode] 99.Recover Binary Search Tree
- C Looooops(扩展欧几里得求模线性方程)
- EdtText默认显示数字键盘,不强制输入数字
- python学习笔记
- 各类排序算法性能对比简述
- atitit.jquery tmpl模板总结 .doc
- 使用 Sahi 实现 Web 自动化测试
- sscanf
- Android Toolbar样式定制详解
- UIPickView
- angularJs学习笔记
- 在cocos2dx中实现水波滤镜 .