Question: I have a text document and I need to add two @ symbols before the keywords present in an array.

**Sample text and Array:**

```
str ="This is a sample text document which consists of all demographic information of employee here is the value you may need,name: George employee_id:14296blood_group:b positive this is the blood group of the employeeage:32"

arr=['name','employee_id','blood_group','age']

```

**Required Text:**

```
str ="This is a sample text document which consists of all demographic information of employee here is the value you may need, @@name: George @@employee_id:14296 @@blood_group:b positive this is the blood group of the employee @@age:32"

```

Answer: 
Just use the `replace` function

```
str ="This is a sample text document which consists of all demographic information of employee here is the value you may need,name: George employee_id:14296blood_group:b positive this is the blood group of the employeeage:32"
arr = ['name','employee_id','blood_group','age']

for w in arr:
    str = str.replace(w, f'@@{w}')
print(str)

```
You can replace the value and add space and double @@ before the replaced value and in the result replace double spaces with one space.

```
str ="This is a sample text document which consists of all demographic information of employee here is the value you may need,name: George employee_id:14296blood_group:b positive this is the blood group of the employeeage:32"
arr=['name','employee_id','blood_group','age']

for i in arr:
    str = str.replace(i, " @@{}".format(i))
print(str.replace("  ", " "))

```

Output

```
This is a sample text document which consists of all demographic information of employee here is the value you may need, @@name: George  @@employee_id:14296 @@blood_group:b positive this is the blood group of the employee @@age:32

```