Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. import sys
  2. import self as self
  3. from os import listdir
  4. from os.path import isfile, join
  5. import os
  6.  
  7.  
  8. # so this program works like this:
  9. # it takes path were are the list of folders. for example folder add, sum.
  10. # it will go into add, sum folder and will try to find add.asm and sum.asm
  11. def create_path(path, name):
  12. return path + '\\' + name + '\\' + name + '.' + 'asm'
  13.  
  14.  
  15. def open(path):
  16. # onlyfiles = [f for f in listdir(path) if isfile(join(path, f))]
  17. file_list = listdir(path);
  18. file_list = [create_path(path, name) for name in file_list]
  19. for my_file in file_list:
  20. if not os.path.isfile(my_file):
  21. print("File path {} does not exist. Exiting...".format(my_file))
  22. sys.exit()
  23. for line in file(my_file).readlines():
  24. strip_line = string.strip(line)
  25.  
  26.  
  27. def main():
  28. try:
  29. path = sys.argv[1]
  30. except:
  31. print("No path entered!\n")
  32.  
  33. # open the file!
  34. open(path)
  35.  
  36.  
  37. if __name__ == "__main__":
  38. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement