import re def extract_o_option(file_path): pattern = re.compile(r'o\s+(\S+)') with open(file_path, 'r') as file: for line in file: match = pattern.search(line) if match: return match.group(1) return None # 使用示例 file_path = 'C:/Users/Administrator/Desktop/29282/29282_9cm_x1.obj' result = extract_o_option(file_path) if result: print(f'Found -o option with value: {result}') else: print('No -o option found')