ich füge einen text mit autokey ein.
Ich muss nun den text den ich einfügen möchte nach URLs durchsuchen und nach der URL ein Leerzeichen senden, dann den restlichen text (mit lerrezichen nach einer url, falls da noch mehr urls sind etc.)
aktuell bin Ich so weit:
Code: Alles auswählen
import re
import time
a_string = 'test of testing https://www.one.com with another test https://two.com part3 http://three.com last test'
urls = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', a_string)
split_string = a_string.split(urls[0])
text = (f'{split_string[0]} {urls[0]} {split_string[1]}')
x=0
for url in urls:
clipboard.fill_clipboard(f'{split_string[0]}')
keyboard.send_keys("<ctrl>+v")
time.sleep(0.5)
clipboard.fill_clipboard(f'{urls[x]}')
keyboard.send_keys("<ctrl>+v")
time.sleep(0.5)
keyboard.send_keys(" ")
time.sleep(0.5)
split_string = (f'{split_string[x+1]}').split(f'urls[x]')
x=x+1
Code: Alles auswählen
test of testing https://www.one.com with another test https://two.com part3 http://three.com last testhttps://two.com
Code: Alles auswählen
with another test https://two.com part3 http://three.com last test
Ich schätze Ich mache da irgendwas mit dem indexing falsch, kann mir jemand helfen?