EdisonChendi
12/9/2016 - 3:38 PM

mastering string manipulation is extremely important

mastering string manipulation is extremely important

# coding=UTF-8
import types

# multi-line string
def multi_line_str():
    s = ('select * '
         'from atable '
         'where afiled="value"')
    print(s)

# multi_line_str()

a = "hi"
assert isinstance(a, types.StringType)
assert isinstance(a, basestring)

b = u"hi"
assert isinstance(b, types.StringTypes)
assert isinstance(b, types.UnicodeType)
assert isinstance(b, basestring)
assert isinstance(b, unicode)

# str方法分类:
# 性质判定
# 查找替换
# 分切与连接
# 变形
# 填空与删减