def generator(): nums = [\'09\', \'98\', \'87\', \'76\', \'65\', \'54\', \'43\'] s_chars = [\'*\', \'&\', \'^\', \'%\', \'$\', \'#\', \'@\',] data =
In the previously reply, I have made a wrong answer because I have misunderstood the requirements, please ignore it.
I think you can use join to simplify the inner loop
join
data = open("list.txt", "w") for c in s_chars: data.write("%s%s\n" % (c, c.join(nums))) data.close()