我正在编写一个python代码,它给了我一个错误,说一个空格是无效的sytanx,看:
from './getinput.py' import getInput as getInput
上面写着这个错误:
line 1
from './getinput.py' import getInput as getInput
^
SyntaxError: invalid syntax
我不知道该怎么办,你们能帮我一下吗?下面是一些必要的代码,让我们从我的主文件开始:
def WhereDoIStart():
print("Hi! How are you? Whats your name?")
name = input()
print('''Well, '''+name+''' i hope you're doing well! This here is not the text i have, but i can include it's features! it has somethings like this: "+", "-", "*", "/"''')
getInput()
WhereDoIStart()
下面是getinput.py中的内容:
def getInput():
Userinput = input(">: ")
return Userinput
来自Python导入系统的文档
https://docs.python.org/3/reference/import.html
第5.4.2节子模块,翻译成您的示例: 如果存在以下文件夹结构
您可以按如下方式导入getinput模块的函数:
相关问题 更多 >
编程相关推荐