On 08/11/2010 10:07 AM, fuglyducky wrote: > I am a complete newbie to Python (and programming in general) and I > have no idea what I'm missing. Below is a script that I am trying to > work with and I cannot get it to work. When I call the final print > function, nothing prints. However, if I print within the individual > functions, I get the appropriate printout. > > Am I missing something??? Thanks in advance!!!!
Yes. You are passing sample_string into the functions, but not doing anything with the return value. > def gen_header(sample_string): ^^^^^^^^^^^^^^^ The sample_string name is rebound to the parameter now, completely hiding the global variable, if that's really what you wanted. > def gen_nia(sample_string): ^^^^^^^^^^^^^^^^^^^ Again. > NIA = """ > anothermultilinestringhere > """ > > sample_string += NIA > return sample_string > > > gen_header(sample_string) > gen_nia(sample_string) Try this: sample_string = gen_header(sample_string) sample_string = gen_nia(sample_string) You could drop the arguments to your functions and use the "global" keyword to get access to sample_string from within the functions, but normally that's a bad idea. -- http://mail.python.org/mailman/listinfo/python-list