字符串
来源:互联网 发布:乖戾知乎 编辑:程序博客网 时间:2024/06/05 14:15
第一个程序是这样的,很简单
print "Hello,world!"
print是打印,那么“Hello,world”是什么呢?是字符串(即“一串字符”)
1、单引号字符串和转义引号
单引号与双引号,事实上,没有区别。为什么两个都可以用呢?因为在某些情况下,他们会派上用场:
>>>peint 'Let's go'SyntaxError: invalid syntax
在这里字符串为’Let’,Python并不知道如何处理后面的s(也就是该行余下的内容)
这时候双引号就派上了用场。另外一个选择就是:用反斜线(\)对字符串中的引号进行转义
>>> print "Let's go"Let's go>>> print 'Let\'s go"Let's go
2、拼接字符串
0 0
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- (五)2.3 查看索引使用情况
- leetcode 手机九宫格输入字母组合
- 利用redis + lua解决抢红包高并发的问题
- Parse JSON into ordered data-structure (in python)
- php完全手册中文版本
- 字符串
- linux环境常用配置
- (四)2.2 mysql 数据库对象优化之--优化索引
- 畅通工程
- Servlet/jsp拾遗
- 2016MUTC9-1010 Jong Hyok and String
- Matlab问答day12
- android流式布局控件
- iOS 同一个工程下 使用多target来构建大量相似App