S
S
simplepy2021-11-19 19:50:52
Python
simplepy, 2021-11-19 19:50:52

How to implement a simple python script?

How can I implement that the script accepts a text, example:

word
word1
word2
!
@
[email protected]
@#$%
%


And so that the script can create all possible combinations of all words and symbols from each line of the text and display each on a new line, for example:

wordword1
wordword2
wordword
word!
[email protected]
[email protected]#
[email protected]
WoRd!
WoRd!$

Also, in order for the script to create another file where it will create different combinations by translating letters into different registers, how can I do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-11-19
@Vindicar

1. itertools.permutations(), itertools.products(), itertools.combinations_with_replacement(). Choose which behavior you want, they are slightly different.
2. There will be VERY many such combinations - up to 2^N, where N is the length of the original string. To present, 16 letters (namely letters) will give 65536 combinations. Do you really need it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question