from datetime import datetime class ProxyUtils: @staticmethod def format_hex_data(data): """格式化十六进制数据显示""" return ' '.join([f"{b:02X}" for b in data]) @staticmethod def extract_pile_id(data): """从数据包中提取桩号""" try: if len(data) > 10: pile_id = ''.join([f"{b:02X}" for b in data[3:11]]) return pile_id return None except Exception: return None @staticmethod def get_current_time(): """获取当前时间的格式化字符串""" return datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-3]