0

I'm writing a python code, and it's giving me a error, that says that an space is an invalid sytanx, look:

from './getinput.py' import getInput as getInput

and it says this error:

line 1
    from './getinput.py' import getInput as getInput
                       ^
SyntaxError: invalid syntax

i don't know what to do, could you guys give me some help? Here is some code if necessary, let's start with my main file:


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() 

here i have what's in getinput.py:

def getInput():
    Userinput = input(">: ")
    return Userinput
1
  • from .getinput import getInput Commented Jun 26, 2020 at 10:30

1 Answer 1

1

From the documentation of Python's import system

https://docs.python.org/3/reference/import.html

Section 5.4.2 Submodules, translated into your example: If there is the following folder structure

spam/
    __init__.py
    getinput.py

You could import the getinput module's function as follows:

from .getinput import getInput as getInput
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.