2
Good staff I have a small text of 1859 words where I have stored it all in a variable string format. The question and the next I have this little code I made below:
w = wordstring.split()
i = 0
for x in w:
c = x.find('Be')
if c == 0:
i += 1
print('{} - {}'.format(i, x))
I’m looking for the exact word that in the case would be 'Be', but in my output it does not return with this precision:
1 - Being
2 - Besides,
3 - Be
4 - Before,
Is there any pythonic way I have that accuracy.
regular expressions saving lives
– GlaucioFonseca
Perfect follows my code in the ideone http://ideone.com/QbM3fP regular expression helped a lot.
– GlaucioFonseca
https://pythex.org/? regex=%5Cbbe%5Cb&test_string=be%20besides%20being%20bee%20be%2C%20be. %20before%2C%20Be%20Be. %20forbe%20be_%20be3%20be&ignorecase=1&multiline=0&dotall=0&verbose=0
– Math