I can't use properly the replace command in python

134 Views Asked by At

I'm new on the platform:

I have a doubt about the use of the replace command.

Here is my code and what I need to do: The thing is that I need to replace a substring with a string sequence.

For example: from: Hitacoworld to Hiworld. The thing is that I part from a dictionary with the string and substrings and I don't know how to get the string without the substring part. I use the command replace this way:

ntdna = ''

ntdna += string.replace(seqs[element],'',)

Where 'string' is my string and 'seqs[element]' are the substrings that I want to remove from the string, but the problem is that when I see the outcome I'm not getting the right string, so I think the problem is in the use of the replace, any hint or something I could use? Ty in advance, I'm lost.

enter image description here

0

There are 0 best solutions below