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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:18:44+00:00 2026-05-26T17:18:44+00:00

I am trying to iterate through a list of float widths that varies. [10.5,

  • 0

I am trying to iterate through a list of float widths that varies.

[10.5, 15.5, 3.7]  <- Randomly generated 

I am using this list of floats to generate spaces between a list of strings I am trying to print. I am doing this via

print ''.join('%*s' %i for i in zip(WIDTHS, LIST_OF_STRINGS))

I am getting the error

TypeError: sequence expected, generator found

Can anyone explain why I am getting this error?

EDIT: Python Version 2.4

  • 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-26T17:18:45+00:00Added an answer on May 26, 2026 at 5:18 pm

    I have modified your code in several ways. Now it works here (Python 2.7):

    strings = ['a','b','c']
    widths1 = [10, 15, 3]
    widths2 = [5, 5, 7]
    ''.join('%*.*s' %i for i in zip(widths1, widths2, strings))
    

    results in

    '         a              b  c'
    

    The width value in a format string is not a float, but two ints, separated by a ..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using SQLite3 with Python 2.5, I'm trying to iterate through a list and pull
I'm new to using Templates in C++, and I'm trying to get iterate through
I'm trying to iterate through a list of users folders in windows in c:\Users
I am trying to iterate through a list and take each part of the
I'm trying to iterate through a list of folders, but I can't seem to
I'm trying to find a way to iterate through an enum's values while using
I am trying to iterate through a list of keys from a hash table
I have a list within a list, and I am trying to iterate through
to get right down to it, I'm trying to iterate through a list of
I am trying to iterate through a list of servers & passwords to change

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.