Code: Select all
строка <число>
Code: Select all
строка <число+1>
Code: Select all
строка <число>
Code: Select all
строка <число+1>
Code: Select all
import re
text = ed.get_text_all()
text = re.sub(r'<([^>]+)>', lambda mo: str(1+int(mo.group(1))), text)
ed.set_text_all(text)
Code: Select all
import re; ed.set_text_all(re.sub(r'<([^>]+)>', lambda mo: str(1+int(mo.group(1))), ed.get_text_all()))
Да.kvichans wrote:Нужны пояснения?
Code: Select all
>>> text = ed.get_text_all()
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'ed' is not defined
Code: Select all
maparea "#7"
Code: Select all
maparea "#8"
Хорошоsergiokapone wrote:Да.kvichans wrote:Нужны пояснения?
Code: Select all
from sw import *
import re
text = ed.get_text_all()
text = re.sub(r'<([^>]+)>', lambda mo: str(1+int(mo.group(1))), text)
ed.set_text_all(text)
Code: Select all
import sw,re; sw.ed.set_text_all(re.sub(r'<([^>]+)>', lambda mo: str(1+int(mo.group(1))), sw.ed.get_text_all()))
Code: Select all
(maparea "#7" "" (rect 3002 3971 34 56 ) (border #008000 ) ) (maparea "#9" "" (rect 3007 3774 35 56 ) (border #008000 ) ) (maparea "#12" "" (rect 2974 3683 68 57 ) ...
Code: Select all
import sw,re; sw.ed.set_text_all(re.sub(r'#(\d+)\"', lambda mo: str(1+int(mo.group(1))), sw.ed.get_text_all()))
Code: Select all
import sw,re; sw.ed.set_text_all(re.sub(r'<([^>]+)>', lambda mo: '<'+str(1+int(mo.group(1)))+'>', sw.ed.get_text_all()))
Code: Select all
import sw,re; sw.ed.set_text_all(re.sub(r'#(\d+)\"', lambda mo: '#'+str(1+int(mo.group(1)))+'"', sw.ed.get_text_all()))