阅读Python中的每个单词和行的其余部分?
举例来说,我有字符串'20 30 i love you'
。如何将 20 和 30 存储到它们自己的变量中,并将字符串的其余部分存储到第三个变量中?
Say for example that I had the string '20 30 i love you'
. How can I store 20 and 30 into their own variables and the rest of the string into a third variable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您希望将其作为单个字符串而不是单词列表,请从 word_list 中创建一个字符串。
Make a string out of the word_list if you want it as a single string instead of a list of words.