I don't know how to write split function

Asked 1 years ago, Updated 1 years ago, 337 views

This may be a very rudimentary question, but I am trying to use the following site to try the split function.

Separate the string! Active engineers explain how to use split functions in Python [for beginners]

In that case, is it okay to write the following image in two lines in In[]?

result='Online, Programming, Learning School, Tech Academy'.split(',')
["Online", "Programming", "Learning School", "Tech Academy"]

Even if I run it, the following appears as Out[], so I think it's probably wrong, but how do I display the split properly?

 ['Online', 'Programming', 'Learning School', 'Tech Academy']

python

2022-12-29 02:29

1 Answers

Perhaps it is running on the Jupiter Notebook, and the referenced site says that it is running on the

    Write and run result='Online, Programming, Learning School, Tech Academy'.split(',') in
  • In, and the variable result will be replaced with ['Online', 'Programming', 'Learning School', 'Tech Academy']
  • So, for example, if you write print(result) on the subsequent In and run it, ['Online', 'Programming', 'Learning School', 'Tech Academy']
  • appears in Out.

That's right.


2022-12-31 19:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.