HACKER
TALK
Home
Channels
beta
Bookmarks
Messages
Notifications
Sign In
Comment
如何优化多个重复的pyhon replace
总共有大概1万个replace替换,如何简化这个代码 我尝试了用for循环遍历数组的方式,但那会非常卡,效率比这个还慢
HD Superman
·
2 years ago
Across the Great Wall, we can reach every corner in the world.
比较懒的做法:放在多个线程里面跑,线程可以按文本分割或者安 replace 任务分割
Reply
Report
Replies
1
LingLing1301
·
2 years ago
但是这个replace必须按顺序替换,不然替换出来的文本就是错误的。。。还有其他办法吗QAQ
Reply
Report
HD Superman
Joined 4 years ago
Across the Great Wall, we can reach every corner in the world.
github.com/hdsuperman
Follow
Message