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 7957157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:12:26+00:00 2026-06-04T04:12:26+00:00

I want to pass two parameters to my string, using % s. I tried

  • 0

I want to pass two parameters to my string, using % s.

I tried this, but it did not work :

title = "im %s with %s"
title % "programming" % "python"

it gives this error :

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not enough arguments for format string

Do you have an idea?
thanks

  • 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-06-04T04:12:27+00:00Added an answer on June 4, 2026 at 4:12 am

    The problem is probably best understood by breaking down how these formatting directives work. The basic idea is that each % in a string means an argument needs to be subsequently supplied to the string.

    For instance, this would work:

    title = "i'm %s with %s" % ('programming', 'python')
    

    and yield

    "i'm programming with python"
    

    The ‘s’ in %s means that this is a place holder for a string. A ‘d’ would be for integers, ‘f’ for floats etc. There are also additional parameters you can specify. See these docs.

    If you don’t supply enough items for each place holder, it will result in the not enough arguments for format string message.

    Your specific example first creates a string constant that has two formatting directives in it. Then when you use it, you’ll have to supply two items for it.

    In other words,

    title = "i'm %s with %s"
    title % ('programming', 'python')
    

    becomes

    "i'm %s with %s" % ('programming', 'python')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Have two problem in this Case : I want to pass a JSON
I want to pass a varying number of parameters between two objects. I have
I want to pass two parameter to nativeProcess. While i am running exe file
i want to ask how to pass parameter between two classes in two different
I want to implement a two-pass cache system: The first pass generates a PHP
I have two pages and I want to pass data to each other. How
i have two flex applications and i want to pass the data from one
I have two ListActivity classes that I want to pass into into a third
I want to call a Stored Procedure which takes two parameters(username & password) and
For example, you want an object to be possibly initialised in two ways, using

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.