n00b - How to list only a range in match?
#1
Hi guys,

First of all thank you for this amazing tools.
I'm not a coder, I just starting to learn python because I want to make add-on for things that I love.
I've started reading some books and testing and i'm loving it. What an hobby this is. Loving it! Just wish I had done this years ago.


I've came across one n00b question, that somehow I can't overcome, so I need your help and I'm sure I will be back with many questions Smile

I want to use only a range of results in my match:
Code:
match=re.compile('<li class="(.+?)"><a href="(.+?)">(.+?)</a></li>').findall(link)

I'm getting 45 matches with len() but I only want to use from 2 to 11.
Somehow I can't get it done.

Can someone please help me?
Reply
#2
Code:
your_data = match[1:12]

Its called slicing.
http://docs.python.org/2/tutorial/introd...html#lists
Reply
#3
(2013-10-28, 12:41)Karnagious Wrote:
Code:
your_data = match[1:12]

Its called slicing.
http://docs.python.org/2/tutorial/introd...html#lists

Thank you so much!!! It's working now.
Reply

Logout Mark Read Team Forum Stats Members Help
n00b - How to list only a range in match?0