John Stiner John Stiner - 3 months ago 17
Python Question

Creating a hyperlink in Python

I'm trying to create a hyper link in python that includes string and variables but i keep getting a syntax error, I think its probably because of quotations but I cant seen to figure it out. Thanks for the help.

'<a href="http://maps.google.com/maps?z=12&t=m&q=loc:'str(p['latitude']+'+'+str(p['longitude']))'">Click Here</a>'})

Answer

Assuming both Latitude and Longitude are Integers:

'<a href="http://maps.google.com/maps?z=12&t=m&q=loc:'+str(p['latitude'])+'+'+str(p['longitude'])+'">Click Here</a>'

Try This.

Your mistake is that you are not concatenating the strings properly.