Python--字符串和对象
2016-01-11 11:08
603 查看
1.常见python函数
2. 字符串和字符
3.编码
1.ASCII码表
2.函数ord()和chr()
3.转义序列
print(” hello word jack’s “) 错误
print(” hello word \”jack’s\”“) 正确
4.不换行打印
print(item , end = ” anyendingstring”)
5.函数 str
6.字符串连接操作
可以用+来对两个数字进行加法,也可以连接两个字符串
7.从控制台读取字符串
[code] abs() max() min() pow() round() fabs() ceil() floor() exp()
2. 字符串和字符
[code]letter='A' message=" good"
3.编码
1.ASCII码表
2.函数ord()和chr()
[code]>>>ch = 'a' >>>ord(ch) 97 >>> chr(98) 'b' >>>ord() 65 >>>
3.转义序列
print(” hello word jack’s “) 错误
print(” hello word \”jack’s\”“) 正确
[code]\b 退格 \t 制表符 \n 换行符 \f 换页符 \r 回车符 \\ 反斜线 \' 单引号 \" 双引号
4.不换行打印
print(item , end = ” anyendingstring”)
5.函数 str
[code]>>> s = str(3.4) # Convert afloat to string >>> s '3.4'
6.字符串连接操作
可以用+来对两个数字进行加法,也可以连接两个字符串
7.从控制台读取字符串
相关文章推荐
- Python--选择语句-循环语句-函数
- Python中sorted函数的用法
- 线性回归和批量梯度下降法python
- Python-层次聚类-Hierarchical clustering
- 【学神-RHEL7】P2-Python流程控制
- 转:Python K-means代码
- 【学神-RHEL7】 P1-Python基础
- Jenkins-测试自动化环境搭建(Python+RobotFramework+selenium)
- 2015年出现的十大流行 Python 库
- Python基本语法
- python正则
- Python爬虫实战五之模拟登录淘宝并获取所有订单
- 用python/java实现hmacmd5加密的一个示例
- python学习网址收集
- Python进阶01-05
- 基于Python实现文件大小输出
- Python Scrapy安装
- python---游戏登录
- Python 爬虫学习稿(二)
- python:科普 使用技巧