I have some code that is basically 5 print statements that i would like to call several times throughout the script. I was thinking I could save some space and make the code easier to maintain if I wrote the code once, then called it later. A function would work but it prints None after it is done and that is annoying. Any suggestions?
Here is kinda what I am trying to do…
name = "Bob"
House = "HOME"
print "hello,"
print name
print house
print "is where you are"
That is just an example, it is way more complicated than that, but i would like to put all of the print statements into a named “bucket” of sorts and then call that bucket.
And some of the code would not just be print statements, but also if statements as well.
Thanks in advance!
If it prints
Noneit is probably because you’re printing the result of the function, as well as letting the function print expressions.e.g.