Skip to content

Instantly share code, notes, and snippets.

@ALiwoto
Last active July 1, 2022 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ALiwoto/5a032128a818e964185c712bef046d16 to your computer and use it in GitHub Desktop.
Save ALiwoto/5a032128a818e964185c712bef046d16 to your computer and use it in GitHub Desktop.
parsing detailed-drop-down-select
<select aria-label="Instance" class="detailed-dropdown select" name="size">
<option value="a0">A0: 1 Cores, 0.75 GB RAM, 20 GB Temporary storage, $0.020/hour</option>
<option value="a1">A1: 1 Cores, 1.75 GB RAM, 70 GB Temporary storage, $0.090/hour</option>
<option value="a2">A2: 2 Cores, 3.5 GB RAM, 135 GB Temporary storage, $0.180/hour</option>
</select>
my_str = open('detailed-drop-down-select.html', 'r').read()
my_strs = my_str.split('</option>')[1:]
with open('final_list.txt', 'a') as f:
for current in my_strs:
current = current.strip()
tmp_strs = current.split('">')
if len(tmp_strs) > 1:
f.write(tmp_strs[1] + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment