Confused: Newbie Function Calls

Wieland Hoffmann the_mineo at web.de
Wed Aug 11 12:31:39 EDT 2010


On 11.08.2010 18:07, fuglyducky wrote:
> Am I missing something??? Thanks in advance!!!!
Assign the returned value of your functions to something (like
sample_string) and it will work:
> ################################################
> # Global variable
> sample_string = ""
> 
> def gen_header(sample_string):
>     HEADER = """
>     mymultilinestringhere
>     """
> 
>     sample_string += HEADER
>     return sample_string
> 
> def gen_nia(sample_string):
>     NIA = """
>     anothermultilinestringhere
>     """
> 
>     sample_string += NIA
>     return sample_string
> 
> 
> sample_string = gen_header(sample_string)
> sample_string = gen_nia(sample_string)
> 
> print(sample_string)




More information about the Python-list mailing list