Saturday, 10 August 2013

Beautifulsoup with Python... example [on hold]

Beautifulsoup with Python... example [on hold]

I used beautifulsoup with Python, but it didn't work.
For example, I want to get articles from a link:
soup =
BeautifulSoup(urllib2.urlopen("http://www.bbc.co.uk/news/uk-england-birmingham-23649067",timeout=1))
n2=len(newstext)
for z in range(n2):
if newstext[z].string is not None:
print (newstext[z].string.encode("utf-8"))
The result:
A 72-year-old man was badly injured when he was hit across the head by an
attacker with a metal bar at a West Midlands pub.
The man and a 21-year-old woman were attacked just before 05:00 BST at The
Three Tuns in Walsall Road, Willenhall.
The 72-year-old suffered serious head and facial injuries and has
undergone surgery for a broken jaw. The woman suffered a cut to the head.
Police said they were trying to work out what had happened.
The attacker is described as black and in his mid-20s.
Det Sgt Angela Baggott said she was confident someone in the local
community would know him.
She added: "The elderly victim was seriously injured and it's important we
get the person who did this off the streets as quickly as possible."
The BBC is not responsible for the content of external Internet sites
A 16-year-old boy is arrested following a police chase on the M6 involving
a stolen car.
RUN BY THE BBC AND PARTNERS
Pat Benson Boxing Academy
The Public
See B'ham & Black Country Activities >
Today, youngsters are gathering at Birmingham's Custard Factory where
their creations will be judged by a panel, as well as handed awards for
their ideas.
Pictured are the team who've been working at BBC Birmingham all week
developing ideas.
A one-minute applause is held at Molineux in memory of former Wolves
player Dave Wagstaffe.
Wagstaffe's family and a selection of former team mates were on the pitch
as it was held.
More on the forthcoming closure of The Public, in West Bromwich.
IT company Open Minds has been based there since 2010 after relocating
from Sutton Coldfield.
Aston Villa and West Bromwich Albion complete their pre-season
preparations with friendly matches against foreign opposition today.
Paul Lambert's side entertain the Spanish outfit Malaga, while the Baggies
welcome Bologna, of Italy, to The Hawthorns.
BBC WM reporters will be there covering the games. You can hear updates on
BBC WM 95.6 FM from 15:00.
Playing for Blackburn in 1976, he was given his marching orders on the day
cards were introduced, for arguing with the referee. Just over 30 minutes
later, George Best was red carded in a different match.
Held on the second Saturday of every month, the market features 20-plus
food stalls and entertainment in the village square.
Lee Clark has seen plenty of positives from the first two competitive
games of the season.
You can hear full commentary on BBC WM 95.6 FM from 15:00 with Mark Regan.
Get ready for plenty of banter and great tunes. Me and "Roving" Richie
Anderson are back to build up to all of today's big games.
Officers believe it is the body of missing 57-year-old John Watkin, who
went missing earlier this week. The death is not being treated as
suspicious.
More pubs are closing in the Midlands than anywhere else in the country,
BBC Midlands Today reports.
Latest figures from the Campaign for Real Ale show 128 closed in six
months. Laura May McMullan will have a report on BBC One shortly after
11:00.
There's three Football League matches taking place today involving teams
from Birmingham and the Black Country.
He told Mirror Sport: "I don't know what Hell is like, but this has to be
worse, I tell you that."
Redditch Borough Council has joined with cycling charity Sustrans to run
the free leisure rides from today.
Did you know former Wolves midfielder Dave Wagstaffe was the first player
in English football to be given a red card?
A largely dry, cool and bright start. Remaining dry for most during the
day with sunny spells, although a few showers are possible in places,
especially later in the afternoon, with highs of 21C (70F).
Good morning, I'll be bringing you the latest news, sport, travel and
weather for Birmingham and the Black Country this weekend.
BBC Autos takes a look at this week's eye-catching images from the world
of motoring
Is politics at war with Budapest's arts scene?
Get a articles from links success, but it's not correct; other text is
included.
Maybe I used the wrong method. How can I get a article only?

No comments:

Post a Comment