string = 'foo.bar.test.ru'
length = len(string.split('.'))
print(length)