for i in range(2, job_count+1):
job_count_array['//form[@id='SubAvailSelectForm']/font/table[2]/tbody/tr[%d]/td[1]/small' % i] = sel.get_text("//form[@id='SubAvailSelectForm']/font/table[2]/tbody/tr[%d]/td[1]/small" % i)
I am getting a syntax error with the value side of this dictionary entry. Let me know what looks wrong to you. The interpreter is pointing to the % i)
. Thanks!
Look at the syntax highlighting. You can't just put a plain ol' '
in your '
-delimited string.
Escape them as \\'
, or change your quotes to be consistent with the second string:
for i in range(2, job_count+1):
job_count_array["//form[@id='SubAvailSelectForm']/font/table[2]/tbody/tr[%d]/td[1]/small" % i] = sel.get_text("//form[@id='SubAvailSelectForm']/font/table[2]/tbody/tr[%d]/td[1]/small" % i)
Your problem is here:
job_count_array['//form[@id='SubAvailSelectForm']/font/table[2]/tbody/tr[%d]/td[1]/small' % i]...
do "//form..."
instead of '//form...'
: double quotes instead of single. As in your string you have 'SubAvailSelectForm'
, which is quoted with single quotes. So either make your string double-quoted, or escape single quotes in your string: '\\''
You have single quotes inside single quotes. The interpreter is confused :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.