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
  • 1
    print ('sending username %s and password %s' % (username, password))? Commented Jun 11, 2019 at 15:45

1 Answer 1

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)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.