Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # A script to print input horizontally
- # by: whye, 2009.11.23-2009,11,25
- #
- import sys
- # function to take string and print it horizontally
- def hz_print(string, col = 0): # accept string
- if col > 0:
- while col not 0:
- for index in range(len(string)):
- print string[index] * col
- -=col # this is a big cluster fuck I just need to loop around through one index and multiply it by column then print blah
- for width in col:
- count = 0
- for index in range(len(string)):
- print string[0] * col
- else:
- for index in range(len(string)): # use the length of the string to loop
- print string[index] # print each index of the string
- if len(sys.argv) < 2:
- sys.exit('Usage: %s input' % sys.argv[0])
- elif len(sys.argv) == 3:
- input, column = sys.argv[1:3] # This has to deal with list slicing very sexy multi assignment
- column = int(column)
- hz_print(input, column)
- print sys.argv, 'in elif'
- else:
- input = sys.argv[1]
- hz_print(input, 0)
- print sys.argv, 'in else'
Add Comment
Please, Sign In to add comment