Advertisement
dequone

demo.py

Nov 30th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. inp = []
  2.  
  3. try:
  4.     f = open("6.txt", "r")
  5.     data = f.read()
  6.     inp = data.split()
  7.     f.close()
  8. except:
  9.     print("No file")
  10.  
  11.  
  12. # from the beginning
  13. while int(inp[0]) == 0:
  14.     inp.pop(0)
  15.  
  16. # the same from the end
  17. L = len(inp)
  18. while int(inp[L-1]) == 0:
  19.     inp.pop(L-1)
  20.     L -= 1
  21.  
  22.  
  23. print(str(inp) + "\n\n-----")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement