Advertisement
lamiastella

fingertips.txt from joints.txt

Jun 14th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. import itertools
  2. print("mona")
  3. fingertips_file = open("fingertips.txt", 'w')
  4. with open("joint.txt") as joints_file:
  5.     next(joints_file)
  6.     for line in joints_file:
  7.         print(line)
  8.         line_split = ' '.join(line.split(' ')[1:]).rstrip()
  9.         line_split = line_split.split(' ')
  10.         list_of_list = []
  11.         iterable = iter(line_split)
  12.         sliced_list = list(iter(lambda: list(itertools.islice(iterable, 3)), []))
  13.         fingertips = []
  14.         fingertips.extend([sliced_list[4], sliced_list[8], sliced_list[12], sliced_list[16], sliced_list[20]])
  15.         print(fingertips)
  16.         print(fingertips[0])
  17.         flat_list = [item for sublist in fingertips for item in sublist]
  18.         print(flat_list)
  19.         str_flat_list = " ".join(str(x) for x in flat_list)
  20.         fingertips_file.write(str_flat_list+"\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement