Every line of 'count substring in string python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
772 def test_substr_count(self): 773 output = self.run(''' 774 echo substr_count('', 'a'); 775 echo substr_count("ababc", "ab"); 776 echo substr_count("ababc", "ab", 1); 777 echo substr_count("ababc", "ab", 5); 778 echo substr_count("ababc", "ab", 1, 2); 779 echo substr_count("ababababa", "aba"); 780 ''') 781 assert [self.space.int_w(i) for i in output] == [0, 2, 1, 0, 0, 2]
29 def test_you_can_get_a_substring_from_a_string(self): 30 string = "Bacon, lettuce and tomato" 31 self.assertEqual('let', string[7:10])