-2

eg: "ABC.sample.int.int01" like that, only want to check this string contains 3 dots. Thanks

jenny
  • 3
  • 2

1 Answers1

0

You can check it like this, with count attribute of str in python. If it is equal to 3, then your strings actually contains exactly 3 dots.

if 'ABC.sample.int.int01'.count('.') == 3:
   ...
else:
   ...
Amir reza Riahi
  • 888
  • 2
  • 6
  • 25