Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7627177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:25:29+00:00 2026-05-31T05:25:29+00:00

Im doing a string formatting for a python program however, i am getting an

  • 0

Im doing a string formatting for a python program however, i am getting an error “not enough arguments for format string”.
my line of portion of code is

a[i][j] = input("college %d %s" %(j+1) %d[i])

can somebody point out my mistake? as i can’t figure out on my own

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:25:30+00:00Added an answer on May 31, 2026 at 5:25 am

    You should be saying

    a[i][j] = input("college %d %s" % (j+1, d[i]))
    

    This is because the % string formatting operator expects a single argument, so if you want multiple formatters, you need to pass a tuple. So I can’t say

    "%s %s" % "Hello" % "World"
    

    I instead must say

    "%s %s" % ("Hello", "World")
    

    If you’re using Python 2.6 or later, you also have the option of using the format method, e.g.

    "college {0} {1}".format(j+1, d)
    

    And if you’re using Python 2.7 or later, you can omit the index values, and simply say

    "college {} {}".format(j+1, d)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any better alternative for doing string formatting in VC6, with syntax checking
Python is doing string multiplication where I would expect it to do numeric multiplication,
I'm interested in doing comparisons between the date string and the MySQL timestamp. However,
I have the following code: double f = (1500 / 3000); MessageBox.Show(string.Format({0:F2},f)); I expect
string str = 'my {0} long string {1} need formatting'; Should I be doing
I would like to do some simple math while I'm doing string formatting. For
For doing string concatenation, I've been doing basic strcpy , strncpy of char* buffers.
When doing a string comparison in C#, what is the difference between doing a
I'm doing simple string input parsing and I am in need of a string
What is the best way of doing case-insensitive string comparison in C++ without transforming

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.