> Many times when I am writing some program in python, I notice that I
> could transform my list into set, then use the set methods like union,
> intersection, set equality etc. , and it will solve my problem easily.
> But then I realize that if I transform my list into set, it will
> remove duplic
To write onto multiple files on the same time (a number of files are variable),
I'd like to code as follows, for example, IF I can do,
LIST_LEN = 4
with [ open('list_%d.txt' % i, 'w') for i in range(LIST_LEN) ] as fobjlist:
for i in range(1000):
fobjlist[random.randrange(LIST_LEN)].write(str