From http://pymbook.readthedocs.org/en/latest/modules.html
I've added some code to this code to make a little header for my code snippets as an exersise.
"""
Bars Module
============
This is an example module with provide different ways to print bars.
"""
def starbar(num):
''' (int) -> integer
Prints a bar with *
>>> bars.starbar(10)
**********
'''
print('*' * int(num))
def hashbar(num):
''' (int) -> integer
Prints a bar with #
>>> bars.hashbar(10)
##########
'''
print('#' * int(num))
def simplebar(num):
''' (int) -> integer
Prints a bar with -
>>> bars.simplebar(10)
----------
'''
print('-' * int(num))
def lp_header():
"""
Prints a header for my py files
"""
hashbar(80)
print "# Filename:\t\n# Copyright:\tLuke Pettit\n# Date:\t\t / /2013"
hashbar(80)
and it prints this :-
################################################################################
# Filename:
# Copyright: Luke Pettit
# Date: / /2013
################################################################################
What I would like to achieve is this:-
#-------------------------------------------------------------------------------
# Filename:
# Copyright: Luke Pettit
# Date: / /2013
#-------------------------------------------------------------------------------
So putting a hash symbol and then a 79 line of - dashes
Can I somehow call two functions one after another and how would I format that
or do I rewite the code entirely?