Python

Methods in String in Python-3

AKA.DM 2024. 9. 26. 07:41
반응형

    The title() method converts only the first letter of the words in a string expression to uppercase

 

    The strip() method in used to trim the values we want from the beginning and end of string values.

    If we don't write anything inside the method, by default it removes all spaces to the left and right.

 

    The strip() method can take a value in it. Trims all of this value at the begining and end of the string expression. 

 

    The rstirp() method is a variable is a variation of the strip method. It is called in an abbreviation for right strip.

    Approximates the right side of the string expression. By default, it removes all spaces to the right.

 

    The rstrip() method can contains values. It approaches the string expression from the right accroding to the value it receives and removes the entire value from the string expresison.

 

    The lstrip() method is a variation of the strip method. It is called and abbreviation of the pharse left strip.

    It approaches the string expression from the left accroding to the value it recieves and removes the entire value from the string expression

 

    By using the dir() function, you can sell all the methods you can applyy to the data types in Python.

    For example, the "space" variable contains a string expression below. If we wirte this variable inside the dir function, we can see all the methods we can apply on the strings.

 

반응형

'Python' 카테고리의 다른 글

Complex Indexing and Slicing Operations in Python  (0) 2024.10.10
Indexing and Slicing in Strings in Python  (0) 2024.10.02
Methods in Strings in Python 2  (0) 2024.09.25
Methods in Strings in Python  (0) 2024.09.24
Boolean Logic Expression in Python  (0) 2024.09.21