Built-in data type Method: string

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:
  1. By index value (forward + reverse take take): Only take.
  2. Sections (care regardless of the end, step).
  3. Learn negative value.
  4. Length len.
  5. Members of the operations in and not in: judge whether there is a sub-string in a large string.
  6. Removing the left and right sides of the character string strip, regardless of the middle.
  7. Segmentation split: some delimiter character strings for tissue, can be cut into split list for further value.
  8. cycle.
  • Need to know
  1. strip,lstrip,rstrip
  2. lower,upper
  3. startswith,endswith
  4. Three play format
  5. split, rsplit
  6. join
  7. isdigit determines whether the string contains purely digital
  • To understanding
  1. find,rfind,index,rindex,count
  2. center, bright, rjust, zfill
  3. expandtabs
  4. captalize, swapcase, title
  5. It is a digital series

Guess you like

Origin www.cnblogs.com/jincoco/p/11135393.html