spliting on ":"
fileexit
mayyash at gmail.com
Mon Mar 6 07:10:37 EST 2006
> yyy
> yyy
> yyy
> xxx.xxx.xxx.xxx
> xxx.xxx.xxx.xxx
of course you will get this result...
inside the loop, when line="xxx.xxx.xxx.xxx:yyy"
line.split(":") will give a list ["xxx.xxx.xxx.xxx", "yyy"], and
element -1 will be "yyy"
but when line="xxx.xxx.xxx.xxx"
line.split(":") will give a list ["xxx.xxx.xxx.xxx"], and element -1
will be "xxx.xxx.xxx.xxx"
So the result is very very normal
More information about the Python-list
mailing list