Hi Pinku,
On 2010-08-11 21:35, Pinku Surana wrote:
> Even though I used the same name "x" for a local and global variable,
> they are actually completely different. When I call "fun(x)" it COPIES
> the global value of "x" into the local variable "x" in "fun". [...]
The global value isn't copied w
In article <2dd74ab4-5ed6-40ac-aea7-705977b61...@g21g2000prn.googlegroups.com>,
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.
Side note: while
On Aug 11, 12:39 pm, fuglyducky wrote:
> On Aug 11, 9:31 am, Pinku Surana wrote:
>
>
>
>
>
> > On Aug 11, 12:07 pm, 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
Rather than patch your code, I think you should see a better approach.
from textwrap import dedent # removes common whitespace prefix
lines = []
def add_header(ss):
"Add header to sequence of string lines"
ss.append(dedent("""\ # No initial blank line
my multi-line
string here
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
functio
On Aug 11, 12:39 pm, fuglyducky wrote:
> On Aug 11, 9:31 am, Pinku Surana wrote:
>
>
>
>
>
> > On Aug 11, 12:07 pm, 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
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
functio
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(sa
On Aug 11, 9:31 am, Pinku Surana wrote:
> On Aug 11, 12:07 pm, 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
This will work:
sample_string=""
def gen_header(sample_string=""):
HEADER = """
mymultilinestringhere
"""
sample_string+= HEADER
return sample_string
def gen_nia(sample_string=""):
NIA = """
ano
On Aug 11, 12:07 pm, 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 w
On 8/11/10 11: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 t
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
13 matches
Mail list logo