strip()
removes all the leading and trailing characters from the input string that match one of the characters in the parameter string:
>>> "abcdefabcdefabc".strip("cba")
'defabcdef'
You want to use a regex: table_name = re.sub(r".csv$", "", name)
or os.path
s path manipulation functions:
>>> table_name, extension = os.path.splitext("movies.csv")
>>> table_name
'movies'
>>> extension
'.csv'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…