python 分割字符
#输入王小明,输出王 小明 #读取原始txt文件 with open('D:\\PCCW_Test_Script\\111.txt', encoding='utf-8') as file1: content = file1.readlines() # print(content) with open('D:\\PCCW_Test_Script\\222.txt', "w", encoding='utf-8') as file2: for name in content: name=name.strip() name_parts = name[:1]+ str(" ")+ name[1:] # print(name_parts) file2.write(name_parts + '\n')

浙公网安备 33010602011771号