Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- path = 'date.txt'
- with open(path) as f:
- for line in f:
- # catch USRP timestamp by regular expression
- pattern = re.compile( r'\b(\d+\.\d+)\b' )
- result = re.search(pattern, line)
- if result:
- timestamp_str = result.groups(1)[0]
- print("\n")
- print( type(timestamp_str) )
- print(f"string result {timestamp_str}" )
- # convert from string to float
- timestamp_float = float(timestamp_str)
- print("\n")
- print( type(timestamp_float) )
- print(f" float result {timestamp_float:.9f}" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement