You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.0 KiB
28 lines
1.0 KiB
from sample.util.util import findnth, get_items
|
|
|
|
|
|
def __find_parts_quantity(parts_list, idx):
|
|
return parts_list[idx][(parts_list[idx].find('<td align="RIGHT">') + 19):findnth(parts_list[idx], '</td>', 1) - 1]
|
|
# current_part = parts_list[idx][(parts_list[idx].find('<td align="RIGHT">') + 19):
|
|
# findnth(parts_list[idx], '</td>', 1) - 1]
|
|
# if current_part == '><td align="CENTER" colspan="5"><font color="#FFFFFF" face="Tahoma,Arial" size="2"><b>Counterparts:</b></font></td></t':
|
|
# return "NaN"
|
|
# else:
|
|
# return current_part
|
|
|
|
|
|
def get_part_quantity(url):
|
|
items = get_items(url)
|
|
part_numbers = []
|
|
|
|
for i in range(len(items)):
|
|
current_part = __find_parts_quantity(items, i)
|
|
# if current_part == "NaN":
|
|
# break
|
|
# elif len(current_part) < 30:
|
|
# part_numbers.append(current_part)
|
|
if len(current_part) < 30:
|
|
part_numbers.append(current_part)
|
|
|
|
return part_numbers
|