gpt4 book ai didi

python - 模块未在 python 中正确导入

转载 作者:太空宇宙 更新时间:2023-11-04 11:00:47 25 4
gpt4 key购买 nike

当我尝试导入以下模块 (ex25.py) 时:

def break_words(stuff): 
"""This function will break up words for us."""
words = stuff.split(' ')
return words

我得到的只是这个:

>>>import ex25

什么都没有...没有提示我做错了什么...几乎就像它甚至没有阅读模块...

最佳答案

我认为您应该键入所有以 >>> 开头的行

import ex25
sentence = "All good things come to those who wait."
words = ex25.break_words(sentence)
words

在你输入最后一行 words 之后,你应该会看到解释器的一些输出

关于python - 模块未在 python 中正确导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5643994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com