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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:04:09+00:00 2026-06-12T00:04:09+00:00

I need to append/format a URL with a list of ids for an API

  • 0

I need to append/format a URL with a list of ids for an API call.

However, when I put the list at the end of the API:

https://api.twitter.com/1.1/users/lookup.json?user_id=%s'%a

I just get an empty string as a response.

I have tried turning the list into a string and removing the square brackets, doing:

a = str(followers['ids'])[1:-1]

but I still get the same problem. I’m assuming that it’s being caused by the single quote at the start.

I have tried removing the apostrophe from the string doing:

a.replace("'", "")

and now I have run out of ideas.

  • 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-12T00:04:10+00:00Added an answer on June 12, 2026 at 12:04 am

    I have tried removing the apostrophe from the string doing …

    You can remove apostrophe from a string using s = s.replace("'", ""). .replace() returns a new string but does not change the orginal string so you’ll to store the returned string.

    >>> string = "he's a jolly good fellow"
    >>> string = string.replace("'", "") 
    >>> string
    'hes a jolly good fellow'
    

    But I don’t think that’s not your problem.

    The ids need to be comma separated, so you’ll probably want to use a .join() to create the string from your list of ids. Example:

    >>> ids = ["1", "23", "123"]
    >>> ",".join(ids)
    '1,23,123'
    

    In your case, assuming followers['ids'] contain a list of id as strings, you can generate your URL using:

    ids = ",".join(followers['ids'])  # generate string of ids (comma separated)
    url = "https://api.twitter.com/1.1/users/lookup.json?user_id=%s" % ids
    

    If followers['ids'] is a list of integers instead of string, then there’s a little more work to do since .join() works only with a sequence of strings. Here’s one way to convert those integers to string on the fly (using a generator expression):

    ids = ",".join(str(id) for id in followers['ids'])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is an example format of the url structure: http://sitename.com/em/state-898899888/new.gif (new.gif is a directory)
I need to get data from an API which returns xml format. here's the
I have a certain URL http://dev.mycompany.com and I need to send some data (in
I need to append multiple nodes to a container. Rather than doing a slow
I need to append some text to an input field...
I need to append log4j content to a Swing component (JTextArea or similar). Is
I need to append text repeatedly to an existing file in Java. How do
I am returning query results from MySQL and I need to append them to
All my div blocks use the same class name and I need to append
I'm creating some scripts to streamline application installations and I need to append to

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.