Joining Strings

Ben Finney ben+python at benfinney.id.au
Wed Apr 6 20:49:49 EDT 2016


Emeka <emekamicro at gmail.com> writes:

> Hello All,
>
> import urllib.request
> import re
>
> url = 'https://www.everyday.com/

This URL doesn't resolve for me, so I can't reproduce the behaviour.

> I got the below:
> "Coke -  Yala Market Branch""NO. 113 IKU BAKR WAY YALA"""
> But what I need is
>
> 'Coke -  Yala Market Branch NO. 113 IKU BAKR WAY YALA'
>
> How to I achieve the above?

To diagnose the problem, I would recommend dividing it into smaller
problems:

* Get the content from that URL, confirm it is as you expect. Deal with
  it as Unicode text from that point forward.

* Transform the Unicode text somehow to produce output. Compare that
  output against the expected output.

That way you can see at what point the behaviour is not as you expect.
Then, please make a more self-contained example that demonstrates the
behaviour confusing you.

-- 
 \      “[Entrenched media corporations will] maintain the status quo, |
  `\       or die trying. Either is better than actually WORKING for a |
_o__)                  living.” —ringsnake.livejournal.com, 2007-11-12 |
Ben Finney




More information about the Python-list mailing list