How can I change the first 5 characters of a string in python? Is there any library or method for this?
An example:
Input:
str1: ABCSDASFA213123
EXPECTED OUTPUT:
str2: XXXXXASFA213123
How can I change the first 5 characters of a string in python? Is there any library or method for this?
An example:
Input:
str1: ABCSDASFA213123
EXPECTED OUTPUT:
str2: XXXXXASFA213123
Slice off the first five characters, and replace them with whatever you like:
new_str = 'X' * 5 + old_str[5:]