#!/bin/env python # Use global in a function definition, to refer to a variable on the outer level def clear_l(): global l l = [] # Without 'global' this will create a new var, that's local to this function l = ["not", "empty"] clear_l() print(l)