469,323 Members | 1,567 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

Help - just a few lines of code needed

Hi

I hope someone can help me out with a very SIMPLE program
about whole string permutations. That is: given a list of strings,
the required outcome is a complete set of all their possible
permutations.
It's like character permutations of a string, but this time it is
whole strings instead of single characters that have to be permuted.

I need this because I don't remember exactly the password to open
my zipped archives, but i do remember the bits of strings
that made up the long passphrase.

Could someone kindly write a simple program that, after reading a set
of
strings contained in a .txt file (one string on each line),
produces as output another .txt file containing all the possible
permutations/combinations of those strings.

For example, the text file with the set of strings may contain:

HOUSE
jolly
---
0&
99
and the output file contains:

HOUSE
HOUSEjolly
HOUSE---
HOUSE0&

and so on...
....with the word combinations growing extensively,
so as to exhaust all the possibilities:

e.g.

---99jolly0&
jolly0&---99HOUSE

etc. etc.

Unfortunately I am not able to program it myself, so
I would appreciate if someone could write this piece of
software, compile it (for DOS or Windows) and send the .exe file to:

lory88 at gmail . com
I thank you all in advance.

Lory

Mar 7 '06 #1
3 1001
lo****@gmail.com wrote:
Unfortunately I am not able to program it myself, so


You should learn how. Its very easy and will make your life better.

Go to www.python.org.

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Mar 7 '06 #2
There is some fine permutation code in the cookbook. Take a look at
http://aspn.activestate.com/ASPN/Coo.../Recipe/190465 .

You can easily code something like:

# xcombinations from the cookbook
def xcombinations(items, n):
if n==0: yield []
else:
for i in xrange(len(items)):
for cc in xcombinations(items[:i]+items[i+1:],n-1):
yield [items[i]]+cc

wordlist = ['HOUSE','jolly','---','0&','99']

for i in xrange(1, len(wordlist)+1):
for g in xcombinations(wordlist, i):
print "".join(g)

Unfortunately I am not able to program it myself, so
I would appreciate if someone could write this piece of
software, compile it (for DOS or Windows) and send the .exe file to:

lory88 at gmail . com


Meet us halfway, here. At least install Python.

Also, it's a dangerous world out there. Don't run .exe s sent to you
by people you don't know.

Mar 7 '06 #3
In article <11**********************@j33g2000cwa.googlegroups .com>,
<jo********@gmail.com> wrote:
There is some fine permutation code in the cookbook. Take a look at
http://aspn.activestate.com/ASPN/Coo.../Recipe/190465 .

You can easily code something like:

Mar 7 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by PHPkemon | last post: by
10 posts views Thread by Sims | last post: by
31 posts views Thread by da Vinci | last post: by
7 posts views Thread by Timothy Shih | last post: by
23 posts views Thread by Jason | last post: by
9 posts views Thread by shuisheng | last post: by
53 posts views Thread by souporpower | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.