Saving output in python -


this question has answer here:

i have code:

import itertools res = itertools.permutations('abcdefghijklmnopqrstuvwxyz',5) # 5 length of result.  in res:     print ''.join(i) 

i need result in stead of being printed print ''.join(i) saved in .txt file.

i not familiar python. thank time!

you can open file in write mode , use fileobject.write method write permutations file :

with open('file_name.txt','w') f:     res = itertools.permutations('abcdefghijklmnopqrstuvwxyz',5) # 5 length of result.      in res:         f.write(''.join(i)+'\n')  

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

excel - I can't get the attachement of the email PHP -

node.js - Express and Redis - If session exists for this user, don't allow access -