I have a large string full of byte code so there is no spaces, I am trying to search for a specific part of that code.
For example;
byte_code = 'ergewyegt6t4738t8347tygfhfh47tg4378t58437t485t454gyfofby3gyfg34t5t6435t3465tg3465t4'
The value I am looking for is 'fhfh47tg'.
I have tried the .find String method but did not have much luck. As mentioned before, the string has no spaces.
I'd expect the output to be true once it has found the pattern within the string.
You can use the in (__contains__) test for substring existence:
if 'fhfh47tg' in byte_code:
print('Match found')
You can also look at methods like str.find, str.index FWIW.
Using re.search is one option:
if re.search(r'fhfh47tg', byte_code):
print("MATCH")
else:
print("NO MATCH")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With