@@ -57,3 +57,28 @@ break | else | from | None | print | with
57
57
class | except | global | or | return | yield
58
58
continue | exec | if | pass | raise |
59
59
60
+ #### 4. Which are some useful string methods in Python ? <br >
61
+ Methods | Description |
62
+ --- | --- |
63
+ ` tolower() ` | Converts a string into lower case |
64
+ ` toupper() ` | Converts a string into upper case |
65
+ ` swapcase() ` | Swaps cases, lower case becomes upper case and vice versa |
66
+ ` islower() ` | Returns True if all characters in the string are lower case |
67
+ ` isupper() ` | Returns True if all characters in the string are upper case |
68
+ ` isalnum() ` | Returns True if all characters in the string are alphanumeric
69
+ |
70
+ ` isalpha() ` | Returns True if all characters in the string are in the alphabet |
71
+ ` isnumeric() ` | Returns True if all characters in the string are numeric |
72
+ ` capitalize() ` | Converts the first character to upper case |
73
+ ` startswith() ` | Returns true if the string starts with the specified value |
74
+ ` endswith() ` | Returs true if the string ends with the specified value |
75
+ ` replace() ` | Returns a string where a specified value is replaced with a specified value |
76
+ ` split() ` | Splits the string at the specified separator, and returns a list |
77
+ ` splitlines() ` | Splits the string at line breaks and returns a list |
78
+ ` join() ` | Joins the elements of an iterable to the end of the string |
79
+ ` strip() ` | Returns a trim version of the string |
80
+ ` lstrip() ` | Returns a left trim version of the string |
81
+ ` rstrip() ` | Returns a right trim version of the string |
82
+ ` count() ` | Returns the number of times a specified value occurs in a string |
83
+ ` find() ` | Searches the string for a specified value and returns the position of where it was found |
84
+
0 commit comments