Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

how to get file extension from command line arguments in python

import os
  
  
# this will return a tuple of root and extension
split_tup = os.path.splitext('my_file.txt')
print(split_tup)
  
# extract the file name and extension
file_name = split_tup[0]
file_extension = split_tup[1]
  
print("File Name: ", file_name)
print("File Extension: ", file_extension)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #file #extension #command #line #arguments #python
ADD COMMENT
Topic
Name
4+4 =