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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:40:41+00:00 2026-06-09T22:40:41+00:00

Is there an equivalent for PHP’s implode in Python? I’ve read in and split

  • 0

Is there an equivalent for PHP’s implode in Python? I’ve read in and split up a set of delimited words, and now I want to sort them out in random orders and print the words out with spaces in between.

implode — Join array elements with a string

http://php.net/manual/en/function.implode.php

  • 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-09T22:40:42+00:00Added an answer on June 9, 2026 at 10:40 pm

    Use the strings join-method.

    print(' '.join(['word1', 'word2', 'word3']))
    

    You can join any iterable (not only the list used here) and of course you can use any string (not only ' ') as the delimiter.

    If you want a random order like you said in your question use shuffle.


    In the comment there was the question why Python throws an error if you do "glue".join(["startString", 123, "endString"]). join operates on an iterable of strings. There is no implicit type conversion in Python.

    But of course there is a solution. Just do the conversion yourself.

    "glue".join(map(str, ["startString",123,"endString"]))

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

Sidebar

Related Questions

Is there a Python equivalent of PHP's mysql_real_escape_string ? I'm trying to insert some
Is there an equivalent in Python for PHP's call_user_func_array ?
Is there a PHP equivalent function to the Python os.path.normpath() ? Or how can
Quite simply, is there a python equivalent to php's phpinfo(); ? If so, what
Python has a nice zip() function. Is there a PHP equivalent?
Is there any equivalent to the PHP list() function in python? For example: PHP:
Do you know if there is a python equivalent of php's virtual() ? My
Is there an equivalent ruby/RoR method for PHP get_meta_tags. I am looking to read
Is there the equivalent of a Java Set in php? (meaning a collection that
Is there a php equivalent of mongrel? I don't want to install Apache, just

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.