table of Contents
Built-in data type Method: string
- Uses:
Describe the nature of things, such as names, hobbies, address and so on.
- Definition:
Use '', "" "" "" "" a string of characters wrapped
name = 'jin' # name = str('jin')
s1 = str(1.1)
s2 = str([1,2,3])
print(s1,type(s1)) # 1.1 <class 'str'>
print(s2,type(s2)) # [1, 2, 3] <class 'str'>
Built-in method
- Priority grasp:
- By index value (forward + reverse take take): Only take.
- Sections (care regardless of the end, step).
- Learn negative value.
- Length len.
- Members of the operations in and not in: judge whether there is a sub-string in a large string.
- Removing the left and right sides of the character string strip, regardless of the middle.
- Segmentation split: some delimiter character strings for tissue, can be cut into split list for further value.
- cycle.
- Need to know
- strip,lstrip,rstrip
- lower,upper
- startswith,endswith
- Three play format
- split, rsplit
- join
- isdigit determines whether the string contains purely digital
- To understanding
- find,rfind,index,rindex,count
- center, bright, rjust, zfill
- expandtabs
- captalize, swapcase, title
- It is a digital series