In [1]:
s = 'abcde'
print(len(s))
In [2]:
s_length = len(s)
In [3]:
print(s_length)
In [4]:
print(type(s_length))
In [5]:
s = 'あいうえお'
print(len(s))
In [6]:
s = 'abcdeあいうえお'
print(len(s))
In [7]:
s = 'a\tb\\c'
print(s)
In [8]:
print(len(s))
In [9]:
s = r'a\tb\\c'
print(s)
In [10]:
print(len(s))
In [11]:
s = '\u3042\u3044\u3046'
print(s)
In [12]:
print(len(s))
In [13]:
s = r'\u3042\u3044\u3046'
print(s)
In [14]:
print(len(s))
In [15]:
s = 'a\nb'
print(s)
In [16]:
print(len(s))
In [17]:
s = 'a\r\nb'
print(s)
In [18]:
print(len(s))
In [19]:
s = 'abc\nabcd\r\nab'
print(s)
In [20]:
print(len(s))
In [21]:
print(s.splitlines())
In [22]:
print(len(s.splitlines()))
In [23]:
print([len(line) for line in s.splitlines()])
In [24]:
print(sum(len(line) for line in s.splitlines()))