-4

This is my code for print: "url = ("https://etherscan.io/address/%s"address)" and i got SyntaxError: invalid syntax

My Python version is 3.7 and i'm new to python I think %s is the problem, i'm not what replacement of that in Python 3.7

DirtyBit
  • 16,613
  • 4
  • 34
  • 55
cristina parker
  • 95
  • 1
  • 1
  • 7

1 Answers1

1
url = ("https://etherscan.io/address/%s" % address)
                                         ^

You're missing the % to assign the variable. Alternatively you can use other forms of string formatting:

Using .format()

url = "https://etherscan.io/address/{}".format(address)

Using f strings:

url = f"https://etherscan.io/address/{address}"

Nordle
  • 2,915
  • 3
  • 16
  • 34