I have a long .txt file containing list of parameters in some given format. Let's say it look like this:
oneParameter = "definedStartSequenceOfTheParameter" + str(actualValueOfTheParameter) + "definedEndSequenceOfTheParameter"
My problem is that I would like to replace the value actualValueOfTheParameter
. But I cannot use .replace
method since I never actually know the value of actualValueOfTheParameter
- it can be string, 10 digit float or 2 digit int, any value you can think of.
This brought me to a question whether there is perhaps some way to tell Python something like this:
find string which starts with "definedStartSequenceOfTheParameter"
and ends with "definedEndSequenceOfTheParameter"
while it does not matter how many or which characters are in between starting and ending string.
I know I could define some function containing for
cycle but first I would like to have your opinion. So I don't shoot myself in the leg in case there exist some simple method or escape sequence that I do not know about.