首页/ 接口索引/ 单位与换算

单位与换算 8 条

document units and conversion

换机器必做的单位探测:
def probe_unit(doc):
  doc.Unit = 6  # 试毫米
  if doc.Unit == 6: return "mm"
  doc.Unit = 2  # 试英寸
  if doc.Unit == 2: return "inch"
  return f"other({doc.Unit})"
已知探测结果后,写 def mm(v): return v/25.4 if unit=="inch" else v 包一层,全篇用 mm,最省心。

本类条目