Hi các anh,
Em có trường hợp này thì phải cắt chuỗi sao các anh
input_data = ‘…kdjfkdsjfkdsjfk…ajhsfdjhdsf’
output_data = ‘’…kdjfkdsjfkdsjfk…’
Bỏ phần mở rộng của một tên file bất kỳ
đọc về regular expression nha
Em dùng os.path.splitext:
>>> import os
>>> filename, file_extension = os.path.splitext('/path/to/somefile.ext')
>>> filename
'/path/to/somefile'
>>> file_extension
'.ext'
không dùng lib import a Đạt ơi,
đại khái là vậy nè anh
input_data = ‘…kdjfkdsjfkdsjfk…ajhsfdjhdsf’
output_data = ‘’…kdjfkdsjfkdsjfk…’
Có lib sẵn sao không xài 
Chào em,em có thể dùng 2 cách, cách 1 library, cách 2 thuật toán.
em có thể tham khảo nhé
package library;
public class RenameFileLibrary {
public static String renameFile(String fileName){
String[] arrImg = fileName.split("\\.");
String duoiFileImg = arrImg[arrImg.length - 1];
String nameFile = "";
for (int i = 0;i< (arrImg.length - 1) ; i++) {
if(i == 0){
nameFile = arrImg[i];
}else{
nameFile += "-"+arrImg[i];
}
}
nameFile = nameFile + "-"+System.nanoTime() +"."+duoiFileImg;
return nameFile;
}
public static void main(String[] args) {
System.out.println(RenameFileLibrary.renameFile("itphutran-doi-ten-file-java.png"));
}
} :
Đây là câu hỏi Python mà bạn 
Chào a Đ,wow,e ko để ý.Thôi thì anh em tham khảo thuật toán nhé. 
Thầy ko cho sài lib a Đạt ơi, mà bài này có 1 số bạn giải đơn giản lắm ,
input_data = ‘…kdjfkdsjfkdsjfk…ajhsfdjhdsf’
print(input_data[:input_data.rfind(’.’)])
…kdjfkdsjfkdsjfk…
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?