How to find a sequence of characters in bytes object with a string in Python

2 Answers

0 votes
b = bytes(b"python php c++")

i = b.find(b"php")

print(i)


'''
run:

7

'''

 



answered Sep 6, 2018 by avibootz
0 votes
b = bytes(b"python php c++")

i = b.find(b"c#")

print(i)


'''
run:

-1

'''

 



answered Sep 6, 2018 by avibootz

Related questions

1 answer 157 views
1 answer 169 views
1 answer 167 views
1 answer 181 views
...