Guest User

Untitled

a guest
Jul 18th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #!/usr/bin/python
  2. # A script to print input horizontally
  3. # by: whye, 2009.11.23-2009,11,25
  4. #
  5.  
  6. import sys
  7.  
  8. # function to take string and print it horizontally
  9. def hz_print(string, col = 0): # accept string
  10. if col > 0:
  11. while col not 0:
  12. for index in range(len(string)):
  13. print string[index] * col
  14. -=col # this is a big cluster fuck I just need to loop around through one index and multiply it by column then print blah
  15. for width in col:
  16. count = 0
  17. for index in range(len(string)):
  18. print string[0] * col
  19. else:
  20. for index in range(len(string)): # use the length of the string to loop
  21. print string[index] # print each index of the string
  22.  
  23.  
  24. if len(sys.argv) < 2:
  25. sys.exit('Usage: %s input' % sys.argv[0])
  26. elif len(sys.argv) == 3:
  27. input, column = sys.argv[1:3] # This has to deal with list slicing very sexy multi assignment
  28. column = int(column)
  29. hz_print(input, column)
  30. print sys.argv, 'in elif'
  31. else:
  32. input = sys.argv[1]
  33. hz_print(input, 0)
  34. print sys.argv, 'in else'
Add Comment
Please, Sign In to add comment