Dear all, I'm trying to create oblique texts by reordering their letters. Here is an exemple to illustrate this (to be display in a monospaced font):
text = """\ ... This ... is ... a ... test""" print(make_oblique(text)) T i h a s i t s e s t
So far I have this: def make_oblique(text): words = text.splitlines() matrix = [[" " for i in xrange(len(words) + len(max(words)))] \ for j in xrange(len(words) + len(max(words)))] for i, word in enumerate(words): for j, letter in enumerate(word): matrix[j + i][j] = letter matrix = map(lambda x: "".join(x), matrix) return "\n".join(matrix) But it is not very flexible. For instance, I'd like to control the "line spacing" (by adding extra spaces in between letters since it isn't real lines). I just found numpy and I have the intuition that it could do the job since it deals with matrices. Am I right? If so how would you do such a thing? Thanks! Alex