-3

For the following code,

import re
n = '.172..16.52.207,172.16.52.117'
s = re.split(',+|\.+',n)
print s

why is the first element of s a blank, i.e. '' ?

the_storyteller
  • 2,335
  • 1
  • 26
  • 37

1 Answers1

0

The first element is everything between the beginning of the string and the first .. There are no such characters, so it is ''. n[2] should be blank as well, because there is nothing between the second . and the third.

the_storyteller
  • 2,335
  • 1
  • 26
  • 37
Acccumulation
  • 3,491
  • 1
  • 8
  • 12