if python is string code example Example 1: if type is string python isinstance(s, str) Example 2: is instance string python isinstance(x, int) isinstance(s, str)