Hi, I'm new to python, but I want to start learning :)
I just wondered if anyone could tell me how to use a variable from a function outside the function?

def hello(textt):
    global text # this makes it global so that its not only accessible in the funktion
    text = textt

hello("hello")
print text

=) enjoy

Thank you =)

Member Avatar for sravan953

Also:

def some_function():
    var="Is this a function?"
    return var
var=some_function()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.