# users='abc,xiaozi,xiaobai,xiaohei,xiaoming,xiaolan'
#
# users2='abc xiaozi xiaobai xiaohei xiaoming xiaolan'
# #'szz-abc',123456
#
# result = users2.split()
# print(result)
#1、按照某个字符串分割
#2、把分割后的元素放到一个list里面
#3、如果指定的字符串不存在,那么就把整个字符串放到list里面
# print(result)
li = ['abc', 'xiaozi', 'xiaobai', 'xiaohei', 'xiaoming', 'xiaolan']
#1、把list'变成字符串
#2、用指定的字符串把list里面的每个元素连接起来
#产生一批用户名
# f = open('names.txt','w',encoding='utf-8')
# # f.write(','.join(li))#只能是写字符串
# # f.write(str(li))
# f.write('abc,123\n')
# f.write('bcd,123\n')
# f.write('bcd3,123\n')
# f.close()
f = open('names.txt','r',encoding='utf-8')
res = f.read()
print(res)
res2 = f.read()
print('res2...',res2)
# print('从文件里面读出来的数据',res)
f.close()