You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
486 B
18 lines
486 B
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')
|
|
|