In [56]:
import os
import csv
In [57]:
def read_tsv_diconary(fpath):
d={}
with open(fpath, 'r') as f:
for line in f:
line =line.split("\t")
if len(line) == 1:
line.append("")
key = line[0].strip()
value = line[1].strip()
if value == "TRUE":
value = True
if value == "":
value = None
if value =="FALSE":
value = False
d[key] = value
return d
In [58]:
directory = "/home/janekg89/Develop/Pycharm_Projects/flutype_webapp/master/studies"
In [ ]:
In [ ]:
In [ ]:
In [74]:
for root, dirs, files in os.walk(directory):
for dir in dirs:
if dir =="measurements":
new_dir = os.path.join(root,dir)
for dirs in os.listdir(new_dir):
meta_path = os.path.join(new_dir,dirs,"meta.tsv")
d = read_tsv_diconary(meta_path)
if "status" in d:
print(d)
In [79]:
from pytz import timezone
import datetime
In [84]:
tim = "01-01-1989 9:30"
dt = datetime.datetime.strptime(tim, '%d-%m-%Y %H:%M')
berlin = timezone('Europe/Berlin')
#tzinfo=
In [78]:
berlin_dt = loc_dt.astimezone(Berlin)
In [ ]: