Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- salut, ma confrunt cu o situatie ciudata. Aceste FIND and REPLACE nu merg. Adica find merge, dar replace nu merge.
- In aceste 3 situatii, trebuie sa inlocuiesc un anuit regex cu (spatiu gol). Vezi acolo acel ' '
- Daca la re.findall as pune orice regex simplu, de exemplu un html tag <div> atunci se face inlocuirea perfect.
- Dar daca este un alt gen de regex, cum sunt cele de mai jos, inlocuirea nu se mai face. Adica nu se intampla nimic...
- if len(re.findall('(?!<p>).+?(?<!</p>)$', page_text)) != 0:
- page_text = re.sub('(?!<p>).+?(?<!</p>)$', '', page_text)
- counter_img += 1
- OR
- if len(re.findall('^\s+</p>', page_text)) != 0:
- page_text = re.compile(r'', page_text)
- counter_img += 1
- OR
- if len(re.findall('\n\s*', page_text)) != 0:
- page_text = re.sub('\n\s*', '', page_text)
- counter_img += 1
Add Comment
Please, Sign In to add comment