Hello
Lets say I have a string:
--a href=/browse/brick--brick--/a--
The -- needs to be replaced with or where applicable.
and I want the brick out of that string (the second brick that is). How
can I get just the brick out of that string?
--
View this message in context:
Alexandr N Zamaraev wrote:
s = '--a href=/browse/brick--brick--/a--'
s
'--a href=/browse/brick--brick--/a--'
''.join('%s' % l if i % 2 == 1 else l for i, l in
enumerate(s.split('--')))
' /browse/brick brick '
--
http://mail.python.org/mailman/listinfo/python-list
I'm sorry, I
Alexnb wrote:
s = '--a href=/browse/brick--brick--/a--'
s
'--a href=/browse/brick--brick--/a--'
''.join('%s' % l if i % 2 == 1 else l for i, l in
enumerate(s.split('--')))
' /browse/brick brick '
I'm sorry, I don't think I was being clear. I replaced the 's with -- so it
would post online
Alexandr N Zamaraev wrote:
Alexnb wrote:
s = '--a href=/browse/brick--brick--/a--'
s
'--a href=/browse/brick--brick--/a--'
''.join('%s' % l if i % 2 == 1 else l for i, l in
enumerate(s.split('--')))
' /browse/brick brick '
I'm sorry, I don't think I was being clear. I replaced the
On Jul 17, 9:50 am, Alexnb:
how can I test to see if the first char of a string is ?
I suggest you to try the interactive shell:
hello[0]
'h'
hello[0] ==
False
hello[0] == h
True
hello.startswith(h)
True
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
bearophileHUGS wrote:
On Jul 17, 9:50 am, Alexnb:
how can I test to see if the first char of a string is ?
I suggest you to try the interactive shell:
hello[0]
'h'
hello[0] ==
False
hello[0] == h
True
hello.startswith(h)
True
Bye,
bearophile
--
Alexnb wrote:
hello[0]
'h'
hello[0] ==
False
hello[0] == h
True
hello.startswith(h)
True
really? That's just like C. I thought that it would fail because of the way
lists work. Thanks!
what way?
the first three will fail if the string is empty.
[0]
Traceback (most recent
BeautifulSoup. You need a good html parsing, not some one-shot code to
handle one tiny unflexable pattern.
On Thu, Jul 17, 2008 at 3:07 AM, Alexnb [EMAIL PROTECTED] wrote:
Hello
Lets say I have a string:
--a href=/browse/brick--brick--/a--
The -- needs to be replaced with or where