【发布时间】:2021-08-05 22:20:16
【问题描述】:
我想在使用以下代码拆分后作为键值发送:
for row in all_data2.itertuples():
for ele in row.vertical_concat.split(" "):
if 3 < len(ele) < 25:
ele_new = str(ele) + str(i) + str(ele)
print(ele_new)
ActionChains(driver).move_to_element(send).send_keys(ele_new).perform()
ActionChains(driver).move_to_element(send).send_keys(Keys.ENTER).perform()
我正在转换这些值并将它们发送为:apple::apple(在这种情况下是必需的格式)。
有没有办法可以删除重复的单词,因为我的值可能为:
apple::apple
apple::apple
我想发送一次。
非常感谢您的任何建议。
【问题讨论】:
-
重复单词是什么意思?你想要的输出是 ['apple::apple'] 而不是 ['apple::apple' ,'apple::apple' ] ?
-
@BlackMath 确切地说,只发送一次该值作为键