From 7666988f3cae377477a3e2f83e6218b2f80bbff0 Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 7 Apr 2023 03:35:52 +0200 Subject: [autoMMS]Improove strip --- autoMMS.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'autoMMS.py') diff --git a/autoMMS.py b/autoMMS.py index f691e19..34302de 100755 --- a/autoMMS.py +++ b/autoMMS.py @@ -17,13 +17,13 @@ if __name__ == "__main__": with open(sys.argv[1],'r') as f: for line in f: if "Text00 = " in line: - info = line[9:-1] # 9 = len('Text00 = ') ,strip the final '\n' + info = line.split(' = ')[1].strip() # 9 = len('Text00 = ') ,strip the final '\n' elif line.startswith('Text'): - info += line[9:-1] + info += line.split(' = ')[1].strip() if line.startswith('DateTime'): - date = line[9:-1] - time = time.strptime(date, '%Y%m%dT%H%M%S') - if info : + date = line.split(' = ')[1].strip() + timeInfo = time.strptime(date, '%Y%m%dT%H%M%S') + if info: a = info else: print("Error : MMS invalide format, no data info found") -- cgit v1.2.3