#!/usr/bin/env python # -*-coding:utf-8-*- # @Author : clover # @Time : 2020/9/15 10:13 def testsplit(): str1 = "www.baidu.com www.baidu.com" list1 = str1.split('.') print(list1) # ['www', 'baidu', 'com www', 'baidu', 'com'] print("-----------分割线--------------") a = list1 dict = {} for key in a: dict[key] = dict.get(key, 0) + 1 print(dict) print("-----------分割线--------------") L = list(dict.items()) print(L) testsplit()