小编Ash*_*ani的帖子

在 python-docx 的同一行中添加两个图像

我正在尝试在 docx 文件中添加两个图像。图像应该是一左一右。使用下面的代码后,图像位置就像我想要的那样左右工作,但它们不在我想要的同一条线上。一个在上面,其他在那个图像下。

我已经尝试过,WD_ALIGN_PARAGRAPH.RIGHT但没有得到我想要的结果。

## Image for Left Side
my_img = document.add_picture(i,width=Inches(0.8),height=Inches(0.8))
last_paragraph = document.paragraphs[-1]
last_paragraph.alignment = WD_ALIGN_PARAGRAPH.LEFT

## Image for Right Side
my_img2 = document.add_picture(i,width=Inches(0.8),height=Inches(0.8))
last_paragraph = document.paragraphs[-1]
last_paragraph.alignment = WD_ALIGN_PARAGRAPH.RIGHT
Run Code Online (Sandbox Code Playgroud)

请帮助我,我希望两个图像在同一行上,就像两个图像一样,它们之间的空间很小。

在此处输入图片说明

python docx python-3.x pandas python-docx

3
推荐指数
1
解决办法
1316
查看次数

Selenium 使用 2captcha Python 提交 recaptcha

我正在尝试使用 Python3、Selenium 和 2captcha 在搜索表单上提交 Recaptcha。除了在 Recaptcha 的文本区域中发送 google-tokin 后提交 Recaptcha 之外,一切正常。请指导我我错过了什么?当我查看 Selenium Webdriver 窗口时,它显示了包含 google-tokin 的 Recaptcha 文本区域,但我无法提交它以继续搜索结果。谢谢。

from selenium import webdriver
from time import sleep
from datetime import datetime
from twocaptcha import TwoCaptcha
import requests

## Launching webdriver
driverop = webdriver.ChromeOptions()
driverop.add_argument("--start-maximized")
driver = webdriver.Chrome("chromedriver/chromedriver",options=driverop)
url = "https://app.skipgenie.com/Account/Login"
sleep(randint(5,10))
email = "..."
password = ".."

input_data = pd.read_excel("input_data.xlsx")
user_Data = []
driver.get(url)
driver.find_element_by_id("Email").send_keys(email)
driver.find_element_by_id("Password").send_keys(password)
driver.find_element_by_class_name("btn-lg").click()

driver.find_element_by_id("firstName").send_keys(input_data.iloc[0][0])
driver.find_element_by_id("lastName").send_keys(input_data.iloc[0][1])
driver.find_element_by_id("street").send_keys(input_data.iloc[0][2])
driver.find_element_by_id("city").send_keys(input_data.iloc[0][3])
driver.find_element_by_id("state").send_keys(input_data.iloc[0][4])
driver.find_element_by_id("zip").send_keys(int(input_data.iloc[0][5]))

# 2Captcha service
service_key = 'ec.....' # …
Run Code Online (Sandbox Code Playgroud)

selenium recaptcha python-3.x selenium-webdriver 2captcha

2
推荐指数
1
解决办法
3475
查看次数