我正在尝试在字符串中删除此模式的所有结果。
,"icon":"Art\/2DArt\/SkillIcons\/passives\/evadepercentage.png"
,"icon":"Art\/2DArt\/SkillIcons\/passives\/evadepercentage.png"
,"icon":"Art\/2DArt\/SkillIcons\/passives\/evade.png"
,"icon":" [[ anything could be here ]] .png"
txt = re.sub('"icon":"(.*).png",','',txt)
我的尝试:
import re
txt = '{21435,"icon":"Art\/2DArt\/SkillIcons\/passives\/newevadepercentage.png",false,true,"Leather and Steel",false,[],["24% increased Evasion Rating and Armour"],439,2,10,0,0,0,[]},{50054,"icon":"Art\/2DArt\/SkillIcons\/passives\/shieldblock.png",false,false,"Shield Block",false,[],["2% additional Shield Block Chance"],440,1,4,0,0,0,[24083]},{44207,"icon":"Art\/2DArt\/SkillIcons\/passives\/barricade.png",false,true,"Shield Mastery",false,[],["4% additional Shield Block Chance","20% increased Defences from equipped Shield"],440,1,0,0,0,0,[59281]},{59281,"icon":"Art\/2DArt\/SkillIcons\/passives\/shieldblock.png",false,false,"Shield Block",false,[],["2% additional Shield Block Chance"],440,1,2,0,0,0,[50054]}'
txt = re.sub('"icon":"(.*).png",','',txt)
print txt
输出:
{21435,false,false,"Shield Block",false,[],["2% additional Shield Block Chance"],440,1,2,0,0,0,[50054]}