Str Argument in Python -
the code
def main(bar): bar = str(bar) print bar main(sys.argv[1:])
prints
['bar']
, instead of just
bar
. should make input argument string? thanks. (python 2.5.2)
by passing sys.argv[1:] you're passing range of first argument every following argument. can of following independently desired results
# target 1 element when passing in main(sys.argv[1]) # or inside of function bar = str(bar[0])
Comments
Post a Comment