my code is so far as followed:
Expand|Select|Wrap|Line Numbers
- def GetFileExtension(fullFileName):
- print fullFileName[-4:]
- def GetBaseName(fullFileName):
- print fullFileName[:-4]
- GetFileExtension("C:/MyFolder/Docs/Notes.txt")
- GetBaseName("C:/MyFolder/Docs/Notes.txt")
question for this question is as followed:
1. The “\” in Windows file paths are represented by “\\” or “/” in Python. Create a FileInfo.py and create two functions: GetFileExtension(fullFileName) and GetBaseFileName(fullFileName). Given “C:/MyFolder/Docs/Notes.txt”, GetFileExtension will return “.txt” and GetBaseName will return “C:/MyFolder/Docs/Notes”. At the top of FileInfo.py, write the code for these two functions. At the bottom of FileInfo.py, write calls to both of these functions using “C:/MyFolder/Docs/Notes.txt” as the argument.
HINTS: You will be using slicing and the len() function to perform this task.
any aide would be greatly appreciated.