Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime
- def read_line(s1):
- fields = s1.split(' ')
- v = fields[1][1:len(fields[1]) - 1]
- datetime_object = (datetime.strptime(v, '%Y-%m-%dT%H:%M:%S%z'))
- data = (fields[0], datetime_object)
- return data
- def check(a):
- if a[1].hour == 20 and a[1].minute == 15 and a[1].second == 0:
- return True
- if a[1].hour == 20 and a[1].minute == 15 and a[1].second == 30:
- return True
- if a[1].hour == 20 and a[1].minute == 14 and a[1].second == 30:
- return True
- return False
- def main():
- file = open('intersec/left.txt', 'r')
- # file2 = open("Task_2_new_method.txt", "a")
- for line in file:
- a = read_line(line)
- if 4 <= a[1].day <= 8:
- if check(a):
- print(a[0], a[1])
- else:
- continue
- file.close()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement