I am Trying to replace a substring in a sentence.
Example: Name Id = Name_ID
Date of Birth = Date_of_Birth
Admission Type = Admission_Type
I have tried the below code
But it does not seem to work.
line = "Name Name Id Username Date of Birth Admission Type"
line.replace("Name Id","Name_ID",1)
line.replace("Date of Birth","Date_of_Birth")
line.replace("Admission Type","Admission_Type"
Expected Output:
line = "Name Name_Id Username Date_of_Birth Admission_Type"
My code Output:
line = "Name Name Id Username Date of Birth Admission Type"