BeautifulSoup output format error: too much whitespace
up vote
0
down vote
favorite
The following code prints abnormally too much whitespace for much of the output.
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'lxml')
print(soup)
Here is the part of the output where the formatting becomes a problem:
Sportsbooks & The Industry Service Plays / " > N e w b i e F o r u m / a > / l i >
Prettify does not change anything. Any idea why this occurs?
beautifulsoup python-requests
add a comment |
up vote
0
down vote
favorite
The following code prints abnormally too much whitespace for much of the output.
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'lxml')
print(soup)
Here is the part of the output where the formatting becomes a problem:
Sportsbooks & The Industry Service Plays / " > N e w b i e F o r u m / a > / l i >
Prettify does not change anything. Any idea why this occurs?
beautifulsoup python-requests
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
The following code prints abnormally too much whitespace for much of the output.
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'lxml')
print(soup)
Here is the part of the output where the formatting becomes a problem:
Sportsbooks & The Industry Service Plays / " > N e w b i e F o r u m / a > / l i >
Prettify does not change anything. Any idea why this occurs?
beautifulsoup python-requests
The following code prints abnormally too much whitespace for much of the output.
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'lxml')
print(soup)
Here is the part of the output where the formatting becomes a problem:
Sportsbooks & The Industry Service Plays / " > N e w b i e F o r u m / a > / l i >
Prettify does not change anything. Any idea why this occurs?
beautifulsoup python-requests
beautifulsoup python-requests
edited Nov 8 at 18:09
asked Nov 8 at 3:35
WooHoo
61
61
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
If you check source code of website, you will see it has whitespaces around it (Right Click on webpage and click 'Show Page Source')
I run your code and it prints without newlines and whitespaces.
You can do something like
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'lxml')
print(soup.prettify())
1
prettify changes nothing on my end. On IDLE and pycharm it both shows something like this: i m g s r c = " h t t p s : / / f o r u m . s t a t i c - f i l e s . c o m / v b 4 / i m a g e s / i c o n s / i c o n 1 . p n g " / > a h r e f = " h t t p s : / / w w w . s p o r t s b o o k r e v i e w . c o
– WooHoo
Nov 8 at 17:38
Wow, that's odd. If you check the source code of the website you will see it has a normal output, no whitespace around characters. May I ask, did you change default fonts on your console or letter spacing between characters?
– Dinko Pehar
Nov 8 at 18:56
1
Interestingly the output is normal when I tried to run it on windows just now.The whitespacing occurs only on my macbook. I have not changed any default fonts or anything else.
– WooHoo
Nov 8 at 19:43
I'm glad you found some breadcrumbs for your problem. Try to solve it. And welcome to stack overflow :) .
– Dinko Pehar
Nov 8 at 20:14
add a comment |
up vote
0
down vote
Try this:
Change to soup = bs4.BeautifulSoup(res.text, 'html.parser') instead of 'lxml'
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'html.parser')
print(soup)
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
If you check source code of website, you will see it has whitespaces around it (Right Click on webpage and click 'Show Page Source')
I run your code and it prints without newlines and whitespaces.
You can do something like
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'lxml')
print(soup.prettify())
1
prettify changes nothing on my end. On IDLE and pycharm it both shows something like this: i m g s r c = " h t t p s : / / f o r u m . s t a t i c - f i l e s . c o m / v b 4 / i m a g e s / i c o n s / i c o n 1 . p n g " / > a h r e f = " h t t p s : / / w w w . s p o r t s b o o k r e v i e w . c o
– WooHoo
Nov 8 at 17:38
Wow, that's odd. If you check the source code of the website you will see it has a normal output, no whitespace around characters. May I ask, did you change default fonts on your console or letter spacing between characters?
– Dinko Pehar
Nov 8 at 18:56
1
Interestingly the output is normal when I tried to run it on windows just now.The whitespacing occurs only on my macbook. I have not changed any default fonts or anything else.
– WooHoo
Nov 8 at 19:43
I'm glad you found some breadcrumbs for your problem. Try to solve it. And welcome to stack overflow :) .
– Dinko Pehar
Nov 8 at 20:14
add a comment |
up vote
0
down vote
If you check source code of website, you will see it has whitespaces around it (Right Click on webpage and click 'Show Page Source')
I run your code and it prints without newlines and whitespaces.
You can do something like
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'lxml')
print(soup.prettify())
1
prettify changes nothing on my end. On IDLE and pycharm it both shows something like this: i m g s r c = " h t t p s : / / f o r u m . s t a t i c - f i l e s . c o m / v b 4 / i m a g e s / i c o n s / i c o n 1 . p n g " / > a h r e f = " h t t p s : / / w w w . s p o r t s b o o k r e v i e w . c o
– WooHoo
Nov 8 at 17:38
Wow, that's odd. If you check the source code of the website you will see it has a normal output, no whitespace around characters. May I ask, did you change default fonts on your console or letter spacing between characters?
– Dinko Pehar
Nov 8 at 18:56
1
Interestingly the output is normal when I tried to run it on windows just now.The whitespacing occurs only on my macbook. I have not changed any default fonts or anything else.
– WooHoo
Nov 8 at 19:43
I'm glad you found some breadcrumbs for your problem. Try to solve it. And welcome to stack overflow :) .
– Dinko Pehar
Nov 8 at 20:14
add a comment |
up vote
0
down vote
up vote
0
down vote
If you check source code of website, you will see it has whitespaces around it (Right Click on webpage and click 'Show Page Source')
I run your code and it prints without newlines and whitespaces.
You can do something like
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'lxml')
print(soup.prettify())
If you check source code of website, you will see it has whitespaces around it (Right Click on webpage and click 'Show Page Source')
I run your code and it prints without newlines and whitespaces.
You can do something like
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'lxml')
print(soup.prettify())
answered Nov 8 at 8:20
Dinko Pehar
586324
586324
1
prettify changes nothing on my end. On IDLE and pycharm it both shows something like this: i m g s r c = " h t t p s : / / f o r u m . s t a t i c - f i l e s . c o m / v b 4 / i m a g e s / i c o n s / i c o n 1 . p n g " / > a h r e f = " h t t p s : / / w w w . s p o r t s b o o k r e v i e w . c o
– WooHoo
Nov 8 at 17:38
Wow, that's odd. If you check the source code of the website you will see it has a normal output, no whitespace around characters. May I ask, did you change default fonts on your console or letter spacing between characters?
– Dinko Pehar
Nov 8 at 18:56
1
Interestingly the output is normal when I tried to run it on windows just now.The whitespacing occurs only on my macbook. I have not changed any default fonts or anything else.
– WooHoo
Nov 8 at 19:43
I'm glad you found some breadcrumbs for your problem. Try to solve it. And welcome to stack overflow :) .
– Dinko Pehar
Nov 8 at 20:14
add a comment |
1
prettify changes nothing on my end. On IDLE and pycharm it both shows something like this: i m g s r c = " h t t p s : / / f o r u m . s t a t i c - f i l e s . c o m / v b 4 / i m a g e s / i c o n s / i c o n 1 . p n g " / > a h r e f = " h t t p s : / / w w w . s p o r t s b o o k r e v i e w . c o
– WooHoo
Nov 8 at 17:38
Wow, that's odd. If you check the source code of the website you will see it has a normal output, no whitespace around characters. May I ask, did you change default fonts on your console or letter spacing between characters?
– Dinko Pehar
Nov 8 at 18:56
1
Interestingly the output is normal when I tried to run it on windows just now.The whitespacing occurs only on my macbook. I have not changed any default fonts or anything else.
– WooHoo
Nov 8 at 19:43
I'm glad you found some breadcrumbs for your problem. Try to solve it. And welcome to stack overflow :) .
– Dinko Pehar
Nov 8 at 20:14
1
1
prettify changes nothing on my end. On IDLE and pycharm it both shows something like this: i m g s r c = " h t t p s : / / f o r u m . s t a t i c - f i l e s . c o m / v b 4 / i m a g e s / i c o n s / i c o n 1 . p n g " / > a h r e f = " h t t p s : / / w w w . s p o r t s b o o k r e v i e w . c o
– WooHoo
Nov 8 at 17:38
prettify changes nothing on my end. On IDLE and pycharm it both shows something like this: i m g s r c = " h t t p s : / / f o r u m . s t a t i c - f i l e s . c o m / v b 4 / i m a g e s / i c o n s / i c o n 1 . p n g " / > a h r e f = " h t t p s : / / w w w . s p o r t s b o o k r e v i e w . c o
– WooHoo
Nov 8 at 17:38
Wow, that's odd. If you check the source code of the website you will see it has a normal output, no whitespace around characters. May I ask, did you change default fonts on your console or letter spacing between characters?
– Dinko Pehar
Nov 8 at 18:56
Wow, that's odd. If you check the source code of the website you will see it has a normal output, no whitespace around characters. May I ask, did you change default fonts on your console or letter spacing between characters?
– Dinko Pehar
Nov 8 at 18:56
1
1
Interestingly the output is normal when I tried to run it on windows just now.The whitespacing occurs only on my macbook. I have not changed any default fonts or anything else.
– WooHoo
Nov 8 at 19:43
Interestingly the output is normal when I tried to run it on windows just now.The whitespacing occurs only on my macbook. I have not changed any default fonts or anything else.
– WooHoo
Nov 8 at 19:43
I'm glad you found some breadcrumbs for your problem. Try to solve it. And welcome to stack overflow :) .
– Dinko Pehar
Nov 8 at 20:14
I'm glad you found some breadcrumbs for your problem. Try to solve it. And welcome to stack overflow :) .
– Dinko Pehar
Nov 8 at 20:14
add a comment |
up vote
0
down vote
Try this:
Change to soup = bs4.BeautifulSoup(res.text, 'html.parser') instead of 'lxml'
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'html.parser')
print(soup)
add a comment |
up vote
0
down vote
Try this:
Change to soup = bs4.BeautifulSoup(res.text, 'html.parser') instead of 'lxml'
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'html.parser')
print(soup)
add a comment |
up vote
0
down vote
up vote
0
down vote
Try this:
Change to soup = bs4.BeautifulSoup(res.text, 'html.parser') instead of 'lxml'
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'html.parser')
print(soup)
Try this:
Change to soup = bs4.BeautifulSoup(res.text, 'html.parser') instead of 'lxml'
import bs4
import requests
res = requests.get('https://www.sportsbookreview.com/forum/search.php?do=finduser&userid=126807&contenttype=vBForum_Post&showposts=1')
soup = bs4.BeautifulSoup(res.text, 'html.parser')
print(soup)
answered Nov 10 at 8:05
NgoCuong
32917
32917
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53201189%2fbeautifulsoup-output-format-error-too-much-whitespace%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown