31 C
Gujarat
HomepythonPython String split() Method

Python String split() Method

 πŸ‘‰ The split() method splits a string into a list. Separate the string in the list where each word is a list item.

Example:


str = "this is a String"
words = str.split()
print(words)

output:


['this', 'is', 'a', 'String']

πŸ‘‰str.split() to create a list of all words in str separated by a space.

if you get the first word in a string.

Example:


str "this is a String"
words = str.split()[0]
print(words)

output:


this

str.split() with [0] to return the first word in str.

RELATED ARTICLES

7 COMMENTS

  1. You can certainly see your enthusiasm within the article
    you write. The world hopes for even more passionate writers like you who are not afraid
    to mention how they believe. Always go after your heart.

  2. Link exchange is nothing else but it is only placing the other person’s webpage
    link on your page at suitable place and other person will also
    do similar in favor of you.

  3. I’d like to thank you for the efforts you have put in penning
    this website. I am hoping to see the same high-grade
    blog posts from you in the future as well. In truth, your creative writing abilities has motivated me
    to get my very own website now πŸ˜‰

  4. Wonderful site you have here but I was wondering if you knew
    of any forums that cover the same topics discussed here?
    I’d really love to be a part of community where I can get opinions
    from other knowledgeable individuals that share the same
    interest. If you have any suggestions, please let me know.
    Thanks!

  5. you are in point of fact a excellent webmaster. The web site loading velocity is amazing.
    It sort of feels that you are doing any unique trick.

    Also, The contents are masterwork. you have done a fantastic activity on this matter!

  6. Thank you, I have recently been looking for information approximately this subject for a while and yours is the best I’ve discovered till now. But, what in regards to the conclusion? Are you positive concerning the supply?

  7. Excellent post. I was checking constantly this blog and I’m impressed! Extremely helpful info specifically the last part πŸ™‚ I care for such info a lot. I was seeking this particular information for a very long time. Thank you and best of luck.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

15,000FansLike
5,000FollowersFollow
536FollowersFollow
- Advertisment -spot_img

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Most Popular