Files
hpos-data/scripts/card_print_data_5.py

14 lines
398 B
Python
Raw Normal View History

2024-01-15 21:00:33 +05:30
import os
import re
file_path = "../../../../Downloads/images/352405884025RAVGMC.jpg"
# Using regular expression to extract the filename without extension
pattern = re.compile(r'/([^/]+)\.[a-z]+$', re.IGNORECASE)
match = pattern.search(file_path)
if match:
extracted_file_name = match.group(1)
print(extracted_file_name)
else:
print("Unable to extract filename from the given path.")