python 8天入门笔记
day01
day02
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
day03 字符串处理函数
引号可以是一对单引号、双引号、三引号(单/双)。
python中三引号可以将复杂的字符串进行复制:python三引号允许一个字符串跨多行,字符串可以包含换行符、制表符以及其他特殊字符。
示例:
var1='hello world' var2="hello python"
var3='''hello world''' var4="""hello python""" (三引号)
print ('hello "dear" ') (避免歧义,无需转义符)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
python访问字符串的值
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Python字符串运算符
a="hello" b="python"
+ 字符串拼接 a+b :hello python
*重复输出字符串 a*2: hellohello
[ ] 通过索引获取字符 a[1]:e
[ : ] 截取字符串中的一部分 a[1:4] ell
in 成员运算符 'e' in a: True
not in 成员运算符 'p' not in a:False
r /R 原始字符串 print r'hello\n'
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Python字符串格式化
print ("my name is %s and weight is %d kg!" % ("zara",13))
》》》my name is zara and weight is 13 kg!
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
字符串各种函数
find
按值传参和按引用传参
卡在idel上,比如anaconda、sublime、python、ipython,准备参考书籍上进行编辑。