Python 如何修复语法错误:无效语法?
我正在编写一个python代码,它给了我一个错误,说一个空格是无效的sytanx,看:Python 如何修复语法错误:无效语法?,python,Python,我正在编写一个python代码,它给了我一个错误,说一个空格是无效的sytanx,看: from./getinput.py'将getinput作为getinput导入 上面写着这个错误: line 1 from './getinput.py' import getInput as getInput ^ SyntaxError: invalid syntax 我不知道该怎么办,你们能帮我一下吗?下面是一些必要的代码,让我们从我的主文件开始:
from./getinput.py'将getinput作为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导入系统的文档 第5.4.2节子模块,翻译成您的示例: 如果存在以下文件夹结构
spam/
__init__.py
getinput.py
您可以按如下方式导入getinput模块的函数:
from .getinput import getInput as getInput
from.getinput导入getinput