python多空格字符串分割 编写GUI小工具时,通常会以空格分割字符串提取参数,这里给出性能最优方式,用正则分割。 import re def format_commands(command: str) -> list: """ 以空格字符串 :command:str : 要分割的字符串 :return list : 返回结果列表 """ commands = re.split('