Removing the tail for loop output, and TXT file write linefeed

person_info = [{"name":"yuze", "age": 88, "gender": "", "hobby": "", "motto": "hehe"},
               {"name":"boge", "age": 18, "gender": "", "hobby": "basketball", "motto": "haha"}]
for i in person_info:
    s=(",".join([str(v) for v in i.values()]))
    with open('boge1.txt','a',encoding='utf-8') as rf:
            rf.write(str(s)+'\r\n')

 

 

Guess you like

Origin www.cnblogs.com/minghong/p/11483047.html
Recommended