On 31/12/2014 21:25, Thuruv V wrote:
Hi all,

Here's the list. .

inlist = ["Fossil Women's Natalie Stainless Steel Watch Brown (JR1385)",
'Balmer Swiss Made Veyron Mens Watch: Black Band/ Black Dial (62625241)',
'Fortune NYC Ladies Quilted Dial Watch: Brown',
'Jeanne Collection w/ Swarovski Elements Watch: Dark Purple Band
(62623659)',
'Swiss Legend Commander Chronograph: Watch Orange/Black (SL-10067-01-ORS)',
'Debussy Ladies Watch: Brown/Gray/Silver 14070 - 62625292',
'#2 Swiss Legend Commander Chronograph: Green (SL-10067-BB-017)',
'Auguste Jaccard 3 Timezone Watch: Black Band/ Gray & Black Dial (62625184)'
]

My code :
i = 0
while i <= len(inlist):
     if 'watch' in str(inlist[i]).lower() or 'watches' in
str(inlist[i]).lower():
         if 'women' in str(inlist[i]).lower() or 'female' in
str(inlist[i]).lower() or 'ladies' in str(inlist[i]).lower():
             print 'FEMale Watch', inlist.index(i),str(i)
         elif 'men' in str(inlist[i]).lower() or 'male' in
str(inlist[i]).lower() or 'chronograph' in str(inlist[i]).lower():
             print 'Male Watch',inlist.index(i),str(i)
         i = next(inlist)

When on executing python skips the last element('Auguste Jaccard 3
Timezone Watch: Black Band/ Gray & Black Dial (62625184)') in the list.

But when accessing through 'print inlist[0]' is possible,i.e it shows
the e;lement. but the list skips it. .
Please enlighten me. .
Thanks.



Why don't you show us your actual code? There is no for loop above and running the actual code gives "ValueError: 0 is not in list" on the first pass through the while loop.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to