Skip to content

Instantly share code, notes, and snippets.

@chendi0x7C00
Created December 9, 2016 15:38
Show Gist options
  • Save chendi0x7C00/8bcda9b683116c6f6275614f6ce52272 to your computer and use it in GitHub Desktop.
Save chendi0x7C00/8bcda9b683116c6f6275614f6ce52272 to your computer and use it in GitHub Desktop.
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方法分类:
# 性质判定
# 查找替换
# 分切与连接
# 变形
# 填空与删减
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment