В Python
import os.path
myPath = '/Users/t/web/perl-python/I_Love_You.html'
(dirName, fileName) = os.path.split(myPath)
(fileBaseName, fileExtension)=os.path.splitext(fileName)
print dirName # /Users/t/web/perl-python
print fileName # I_Love_You.html
print fileBaseName # I_Love_You
print fileExtension # .html
В QT
filePath = self.filePath
if not filePath:
filePath = '../data'
fileName = QFileDialog.getOpenFileName (filePath, 'Arrays (*.inf; *.INF)', self, 'Select Array')
if not fileName:
return
Размер файла python
import os
folder_size = os.path.getsize(filename)