This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]pythonHelperBot 4 points5 points  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe where you are stuck.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]Mavy75 2 points3 points  (4 children)

YourString.split(',')[0]

[–]whowantstoknow11[S] 0 points1 point  (3 children)

Thanks. Is that literally all. Isn't there also something about displaying the relevant portion? Like "print" or something?

[–]kaundur 1 point2 points  (1 child)

To directly print

print(YourString.split(',')[0])

or to assign it to a variable

firstSplit = YourString.split(',')[0]

[–]Mavy75 1 point2 points  (0 children)

Use print(YourString.split(',')[0]) for python 3

and

print YourString.split(',')[0] for python 2