如何修复语法错误:无效语法?

2024-09-19 12:36:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在编写一个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