repl.it
@yulin1127/

python-basic-hw07-4

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
raw_log_file = '128.90.16.86,186.182.189.72,70.25.134.67,153.40.249.245, 58.246.211.25,128.90.16.86,186.182.189.72,170.25.134.67, 10.40.249.245,58.246.211.25'
#利用split將字串分割為list
ip_address = (raw_log_file.split(','))
# 印出ip
print(ip_address)
# 印出ip數目
print(len(ip_address))
#利用set不重複特性,去除重複的元素
ip_address_unique = set(ip_address)
# 印出不重複的ip
print(ip_address_unique)
# 計算不重複的ip數目並印出
print(len(ip_address_unique))