小编AFF*_*AFF的帖子

更换和剥离功能

我试图创建一个函数来替换给定字符串中的一些值,但我收到以下错误: EOL while scanning single-quoted string.

不确定我做错了什么:

 def DataClean(strToclean):
        cleanedString = strToclean
        cleanedString.strip()
        cleanedString=  cleanedString.replace("MMMM/", "").replace("/KKKK" ,"").replace("}","").replace(",","").replace("{","")
        cleanedString = cleanedString.replace("/TTTT","")
        if cleanedString[-1:] == "/":
           cleanedString = cleanedString[:-1]

        return str(cleanedString)
Run Code Online (Sandbox Code Playgroud)

python ironpython

0
推荐指数
1
解决办法
331
查看次数

标签 统计

ironpython ×1

python ×1