这是一个创建于 2191 天前的主题,其中的信息可能已经有所发展或是发生改变。
比如这样一段字符串
<meta name="detectify-verification" content="d0264f228155c7a1f72c3d91c17ce8fb" />
<meta name="p:domain_verify" content="b87e3b55b409494aab88c1610b05a5f0"/>
<meta name="alexaVerifyID" content="OFc8dmwZo7ttU4UCnDh1rKDtLlY" />
<meta name="baidu-site-verification" content="D00WizvYyr" />
content 里面的内容是随机的,如何把他们替换成
<meta name="detectify-verification" content="d0264f228155c7a1f72c3d91c17ce8fb.html" />
<meta name="p:domain_verify" content="b87e3b55b409494aab88c1610b05a5f0.html"/>
<meta name="alexaVerifyID" content="OFc8dmwZo7ttU4UCnDh1rKDtLlY.html" />
<meta name="baidu-site-verification" content="D00WizvYyr.html" />
我只懂得把 content 的内容提取出来,再 for 循环一个个替换,但是感觉有点麻烦,有没有办法不使用循环,直接用 replace 或者 re 搞定?
|
|
1
zhzer 2018-09-28 11:58:14 +08:00 via Android
过于基础了吧,建议百度,现在给你写了下次还要问
|
|
|
2
imn1 2018-09-28 12:03:01 +08:00
同意#1 不就把 " /> 替换成 .html" /> ?
你不会从来没用过替换方法吧?
|
|
|
3
luckybo 2018-09-28 12:04:41 +08:00
不就是 content=""里面的字符串+‘.html ’么😓
|
|
|
5
Raisu 2018-09-28 12:05:30 +08:00
这。。。。。。建议多做一些处理字符串的练习
|