Re: [Tutor] elegant way to turn list into string

2005-05-07 Thread Chris Smith
> while x < 26: > new_alph = alph[1:] + alph[:1] > print new_alph > print "\n" > x += 1 > > But this has the drawback of not progressing with my > newly create alphabet, it just returns: > abcdefghijklmnopqrstuvwxyz The reason that new_alph never changes is that you are calculating

Re: [Tutor] elegant way to turn list into string?

2005-05-07 Thread Alan Gauld
> alph = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q"," r","s","t","u","v","w","x","y","z"] import string alph = string.lowercase > print "\n" > print alph > print "\n" print '\n%s\n' % alph > x = 1 > while x < 26: for letter in alph: > alph.append(alph.pop(0)) >

Re: [Tutor] elegant way to turn list into string?

2005-05-07 Thread jfouhy
Quoting Max Russell <[EMAIL PROTECTED]>: > anyway- I don't like the output which come in the > form: > ['b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', > 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', > 'w', 'x', 'y', 'z', 'a'] > > > What I'd like to do is take my list and turn it into

Re: [Tutor] elegant way to turn list into string?

2005-05-07 Thread tanja pislar
hi Max, you can use: alph = ["a","b", ] myString = "".join(alph) print myString regards, tanja On 5/7/05, Max Russell <[EMAIL PROTECTED]> wrote: > Hello- > > I've started writing a suite of tools to help me do > Crypto puzzles (slowly...) My first snippet of code > allos me to print out a

[Tutor] elegant way to turn list into string?

2005-05-07 Thread Max Russell
Hello- I've started writing a suite of tools to help me do Crypto puzzles (slowly...) My first snippet of code allos me to print out a Caesar shifting alphabet, as I tend to write them out by hand; which is a waste of time. alph = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","