SHARE
TWEET

Untitled

a guest Jan 21st, 2020 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Research:
  2.     def __init__(self, name, hour, machine, seq):
  3.         self.name = name
  4.         self.hour = hour
  5.         self.machine = machine
  6.         self.seq = seq
  7.  
  8. researchlist = []
  9.  
  10. filelist = []
  11.  
  12. import os
  13. for root, dirs, files in os.walk("data"):
  14.     for file in files:
  15.         if file.endswith(".txt"):
  16.             f = open(root+'\\'+file, 'r')
  17.             lines = f.readlines() #список всех строк
  18.             num_lines = len(lines)
  19.             if num_lines > 51:
  20.                 filelist.append(root+'\\'+file)
  21.  
  22. for l in filelist:
  23.     fi = open(l, 'r')
  24.     for line in fi:
  25.         array = line.split('\t')
  26.         if array[0] != "ID": #пропустили первую строку с айди
  27.             if not array[4].count(array[4][0]) == len(array[4]): #повторяющийся символ
  28.                 res = Research(array[1], array[2], array[3], array[4])
  29.                 researchlist.append(res)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top