J. String Methods (Replace, Join, Splitlines, zfill)

String replace() Method

- The replace() method Returns a string where a specified value is replaced with a specified value.



String join() Method

- The join() method is used for adding str2 string between str1 elements 
(in the below code).
- We can use a Tuple() also instead of a List[].



String splitlines() Method

- The splitlines() method is used for Splitting the string at line breaks (\n) and returns a list.
- We can use \n for split lines.


String zfill() Method

- The zfill() method is used for filling the string with a specified number 0 at the beginning by their length.

- In str2, length is 
10, and fill with 0. (in the below code)



Comments