Skip to content
Advertisement

How can I use a variable in website link using Python?

I want to send WhatsApp messages to numbers without adding them contact using Python.

webbrowser.open('https://api.WhatsApp.com/send?phone=number')

I used upper code in my program but Ii want to ask that, I am making a TkInter project, in my program cph is phone number variable and I also called cph.get() function but how can I use this cph variable in this link.

Advertisement

Answer

You can define your link before opening it.

link = "https://api.WhatsApp.com/send?phone=" + variable
webbrowser.open(link)
Advertisement