heartandsole.Activity.from_tcx
- classmethod Activity.from_tcx(file_obj)[source]
Construct an Activity from a .tcx file.
- Parameters
file_obj – Any file-like object accepted by
activereader.Tcx- Returns
Activity
Examples
Provide a file path:
>>> act = Activity.from_tcx('my_activity.tcx')
Provide a raw string of bytes:
>>> with open('my_activity.tcx', 'rb') as fb: ... raw_data = fb.read() >>> act = Activity.fom_tcx(raw_data)
Provide a string (no encoding info):
>>> with open('my_activity.tcx', 'r') as f: ... xml_string = f.read() >>> act = Activity.fom_tcx(xml_string)