-2

Im new to python and wondering if there is a way for it to open a webpage depending on whats been inputted. EG

Market=input("market")
ticker=input("Ticket")

would take you to this part of the website.

https://www.tradingview.com/symbols/'market'-'ticker'/technicals

Thanks

vash_the_stampede
  • 4,590
  • 1
  • 8
  • 20

2 Answers2

0

Looks like you were pretty much there, but it python you can use the + sign to concatenate strings and then cause it to open that link using webbrowser library

import webbrowser
market=input("market") 
ticker=input("Ticket") 
webbrowser.open('https://www.tradingview.com/symbols/'+market+'-'+ticker+'/technicals')
Sven Harris
  • 2,884
  • 1
  • 10
  • 20
0

Its cleaner to use format string like this:

import webbrowser         
market=input("market")    
ticker=input("Ticket")     
webbrowser.open(f'https://www.tradingview.com/symbols/{market}-{ticker}/technicals')
tbzk
  • 57
  • 1
  • 10