def func(name):
return name, 'param1', 'param2', 'param3'
f = open('test.file', 'w')
f.writelines(['name1\n', 'name2\n', 'name3\n'])
f.close()
# start
f = open('test.file', 'r')
data = [','.join(func(name.rstrip()))+'\n' for name in f.readlines()]
f.close()
f = open('test.file', 'w')
f.writelines(data)
f.close()