zogzog

Untitled

Apr 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import sys
  2. import os
  3. #import Tkinter, tkFileDialog
  4.  
  5. def main():
  6.  
  7. #root = Tkinter.Tk()
  8. #root.withdraw()
  9. #file_path = tkFileDialog.askopenfilename()
  10. filepath = "hej.txt"
  11.  
  12. if not os.path.isfile(filepath):
  13. print("hittar ingen fil".format(filepath))
  14. sys.exit()
  15.  
  16. fp = open(filepath, 'r')
  17. fp2 = open('bajs.txt', 'w')
  18. cnt = 0
  19. for line in fp:
  20. new=line.split("N")[0]
  21. print(new+"\n")
  22. fp2.write(new+"\n")
  23. cnt += 1
  24. fp.close()
  25. fp2.close()
  26.  
  27.  
  28.  
  29.  
  30.  
  31. if __name__ == '__main__':
  32. main()
Advertisement
Add Comment
Please, Sign In to add comment