content of the csv file A_B_C,B,C D_2_4,E,F import csv with open('testfile.csv') as csvDataFile: csvReader = csv.reader(csvDataFile) for row in csvReader: #if csvReader.line_num==1: #continue g=row[0].split("_") print("".join(g[0:1])) output A D 不曉得為什麼這裡join結果不是 AB D2