Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Regular Expression
Post: RE: Regular Expression
Hi,
My code is now working:
pattern = re.compile(r'<(img.+.+)>', re.DOTALL)
matches = pattern.finditer(text)
for match in matches:
print(match.group(0))But I'm trying to replace the matc... |
|
stahorse |
Data Science |
9 |
1,523 |
Jul-11-2023, 10:12 AM |
|
|
Thread: Put the new line after regex pattern
Post: RE: Put the new line after regex pattern
(Jul-08-2023, 10:44 PM)Pedroski55 Wrote: Maybe try re.sub()? That is for replacing bits of a string with something else.
import re
mystring = """
<img width="874" height="162" id="Picture_x0020... |
|
stahorse |
Data Science |
5 |
952 |
Jul-10-2023, 09:29 AM |
|
|
Thread: Put the new line after regex pattern
Post: RE: Put the new line after regex pattern
(Jul-06-2023, 08:35 PM)Larz60+ Wrote: Please do not create new threads on same or very related subject.
Instead, continue posts on original thread.
read carefully https://python-forum.io/thread-4029... |
|
stahorse |
Data Science |
5 |
952 |
Jul-07-2023, 10:29 AM |
|
|
Thread: Put the new line after regex pattern
Post: Put the new line after regex pattern
Hi,
I have this code:
Quote:text = """MyCo Please have a look at this building’s premium. It looks to be a very high rate. <img width="874" height="162" id="Picture_x0020_2" src="cid:image001.pn... |
|
stahorse |
Data Science |
5 |
952 |
Jul-06-2023, 02:06 PM |
|
|
Thread: Findall() ReGex
Post: Findall() ReGex
Hi,
I have this regex:
Quote:content = """encoding="UTF-8"\?>(.*?)^<\?xml version="1.0"
MYCO Please have a look at this building’s premium. It looks to be a very high rate. The client has ... |
|
stahorse |
Data Science |
2 |
807 |
Jul-06-2023, 08:17 AM |
|
|
Thread: Regular Expression
Post: RE: Regular Expression
Thank you for all the replies, I appreciate them, I will try BeautifulSoap too.
I got it by doing this:
pattern = re.compile(r'<(img.+.+)>', re.DOTALL)
matches = pattern.finditer(text)
for ma... |
|
stahorse |
Data Science |
9 |
1,523 |
Jul-05-2023, 02:46 PM |
|
|
Thread: Regular Expression
Post: RE: Regular Expression
pattern = re.compile(r'<img.+.+')
matches = pattern.finditer(text, re.DOTALL)
for match in matches:
print(match.group(0))Nothing still, I still get the same part of output, not all.
I'm getti... |
|
stahorse |
Data Science |
9 |
1,523 |
Jul-05-2023, 12:10 PM |
|
|
Thread: Regular Expression
Post: RE: Regular Expression
Thank you, I do get the first part of the output, but the second part is still outstanding which is on the second line:
Output:Description automatically generated" style="width:9.1in; height:1.6833in"... |
|
stahorse |
Data Science |
9 |
1,523 |
Jul-05-2023, 09:21 AM |
|
|
Thread: Regular Expression
Post: Regular Expression
Hi,
I have this code below:
Import re
Quote:text = """
ATT Please have a look at this building’s premium. It looks to be a very high rate. <img width="874" height="162" id="Picture_x0020_2" sr... |
|
stahorse |
Data Science |
9 |
1,523 |
Jul-05-2023, 06:28 AM |
|
|
Thread: Python Regulare Expression
Post: Python Regulare Expression
I have this code here and I want to know how to interpret it: found = re.findall(
r'encoding="UTF-8"\?>(.*?)^<\?xml version="1.0"', clean, re.M | re.S,
)I can see where "Clean" comes... |
|
stahorse |
Data Science |
1 |
639 |
Jul-04-2023, 12:04 PM |
|
|
Thread: Deleting characters between certain characters
Post: RE: Deleting characters between certain characters
I managed to clean the file to this point:
Quote: Good day Any feedback on the email below. Thanks Horse BrownPersonal Assistante: [email protected]: 000 000 0000 f: 000 000 0000 VCa... |
|
stahorse |
Data Science |
7 |
1,128 |
Jun-29-2023, 07:51 PM |
|
|
Thread: Deleting characters between certain characters
Post: RE: Deleting characters between certain characters
(Jun-29-2023, 08:02 AM)createcarved Wrote: import re
# Read in the file
with open("filename.html", "r") as f:
content = f.read()
# Remove everything between "<!--" and "-->", including t... |
|
stahorse |
Data Science |
7 |
1,128 |
Jun-29-2023, 12:16 PM |
|
|
Thread: Deleting characters between certain characters
Post: RE: Deleting characters between certain characters
Thank you so much, essentially that's what I would need, although it's just the beginning. I need to get rid of HTML tags and leave the normal text. Everything HTML tags need to go. One of the normal ... |
|
stahorse |
Data Science |
7 |
1,128 |
Jun-29-2023, 07:09 AM |
|
|
Thread: Deleting characters between certain characters
Post: Deleting characters between certain characters
Hi,
I have this file here:
Output:<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 15 (filtered med... |
|
stahorse |
Data Science |
7 |
1,128 |
Jun-28-2023, 04:49 PM |
|
|
Thread: __getitem__ Error
Post: RE: __getitem__ Error
(Jun-15-2022, 08:21 AM)buran Wrote: You are trying to read 2 config files, you are the one that wrote this line
config.read(['config.cfg', 'config.dev.cfg'])How shall we know why do you read these f... |
|
stahorse |
General Coding Help |
4 |
4,256 |
Jun-15-2022, 08:31 AM |
|
|
Thread: __getitem__ Error
Post: RE: __getitem__ Error
(Jun-15-2022, 07:37 AM)buran Wrote: Please, check that files 'config.cfg' and 'config.dev.cfg' are in current working directory and show/check their content
you can check which files were parsed suc... |
|
stahorse |
General Coding Help |
4 |
4,256 |
Jun-15-2022, 08:07 AM |
|
|
Thread: __getitem__ Error
Post: __getitem__ Error
Hi,
I have this code below:
import configparser
import graph
def main():
# print('Python Graph Tutorial\n')
# Load settings
config = configparser.ConfigParser()
config.read(['confi... |
|
stahorse |
General Coding Help |
4 |
4,256 |
Jun-15-2022, 07:33 AM |
|
|
Thread: Error trying to Calling web service
Post: RE: Error trying to Calling web service
(May-22-2019, 08:44 AM)heiner55 Wrote: Maybe you should also show us your code.
The code throws an error at the end when I call this line Quote: response = client.service.exportUsers()
import codec... |
|
stahorse |
General Coding Help |
2 |
2,423 |
May-22-2019, 09:09 AM |
|
|
Thread: Error trying to Calling web service
Post: Error trying to Calling web service
Hi,
I'm getting this error below trying to call Web Service, can some help me as to what does it mean?
I took the working code and now trying to change the web url link.
Error:CRITICAL WebFault err... |
|
stahorse |
General Coding Help |
2 |
2,423 |
May-22-2019, 08:33 AM |
|
|
Thread: Reading a Regex
Post: RE: Reading a Regex
Thank you for the response, I actually managed to get it working, this is what I did:
pattern = re.compile(r'NoError.*')
found = re.findall(pattern, text)
for match in found:
print(match) |
|
stahorse |
General Coding Help |
4 |
2,480 |
May-16-2019, 07:24 AM |