I am new to python so I have this question. First let me tell you what I want to do. I have a file that contains something like this:
-0
1
3
5
-00
2
3
18
321
...
I want to take each element except -0, -xxxx string and convert them into sequence numbers, for example:
-0
1
2
3
-00
4
2
5
6
...
I have done this and I have saved the index to a dictionary But I want to replace them inside the string too.
I want to replace the exact words, I do not want to replace words that may be contained to another word for example:
111 replaced by 6
not 445111 replaced by 6 ~>4456
I had this idea but I do not know if it is efficient or worth. For every elements inside -xxxx I will create a list, append its elements, then rename them and replace them, and then save them to the file. Any ideas ?
' '+word+' 'bystr(count)or use regex word boundary.