Skip to content

How to fetch all chars of a string before a space in Python?

>>> s1.split(':')
['Username', ' How are you today?']
>>> s1.split(':')[0]
'Username'
See also  How to iterate a queue in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.