0

i have a piece of code that just prints a username from a json list and a password is randomly generated

print ('sending username %s and password %s' % username, password)

But i get the following error:

        print ('sending username %s and password %s' % username, password)
TypeError: not enough arguments for format string

1 Answers1

0

print ('sending username %s and password %s' % username, password) means:

call print with two arguments:

  • 'sending username %s and password %s' % username
  • password

The first string doesn't get enough formatting arguments (one instead of two). You meant to use a tuple:

'sending username %s and password %s' % (username, password)
ForceBru
  • 36,993
  • 10
  • 54
  • 78