Added a translate function
This commit is contained in:
parent
20167b4c6a
commit
76657435c4
@ -49,4 +49,12 @@ def visit_horizontal (lines, callback, mark, blank):
|
|||||||
|
|
||||||
def print_lines (lines):
|
def print_lines (lines):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
stdout.write('{}\n'.format(''.join(line)))
|
stdout.write('{}\n'.format(''.join(line)))
|
||||||
|
|
||||||
|
def translate(shape, x=0, y=0, space_char=' '):
|
||||||
|
translated = [[] for _ in range(y)]
|
||||||
|
|
||||||
|
for line in shape:
|
||||||
|
translated.append([space_char for _ in range(x)] + line)
|
||||||
|
|
||||||
|
return translated
|
Loading…
Reference in New Issue
Block a user