Ad

def foo(l):
r = copy(l)
return r

l = [1,2]
print(l)
n = foo(l)
print(n)
l.append(7)
print(n)
print(l)

def foo(l):
	r = l
	return r

l = [1,2]
print(l)
n = foo(l)
print(n)
l.append(7)
print(n)
print(l)
Code
Diff
  • #!/usr/bin/env python
    
    import optparse
    
    def log(msg):
    	print(msg)
    
    def info(msg):
        log("[*]: %s " % msg)
    
    def debug(msg):
        log("[D]: %s" % msg)
    
    def main():
        parser = optparse.OptionParser(description="doit")
        parser.add_option("-f", dest="flags", action="store", default=None, help="flags")
        (opts,args) = parser.parse_args()
        debug(opts)
        return 0
    
    if __name__ == "__main__":
        main()
    • #!/usr/bin/env python
    • import optparse
    • def log(msg):
    • print(msg)
    • def info(msg):
    • log("[*]: %s " % msg)
    • def debug(msg):
    • log("[D]: %s" % msg)
    • def main():
    • print "hello world"
    • parser = optparse.OptionParser(description="doit")
    • parser.add_option("-f", dest="flags", action="store", default=None, help="flags")
    • (opts,args) = parser.parse_args()
    • debug(opts)
    • return 0
    • if __name__ == "__main__":
    • main()
import pprint;pprint.pprint(zip(('Byte', 'KByte', 'MByte', 'GByte', 'TByte'), (1 << 10*i for i in xrange(5))))
Code
Diff
  • #!/usr/bin/env python
    
    import re,sys,optparse
    
    def debug(msg):
    	print("[DEBUG]: %s" % msg)
    
    def main():
    	parser = optparse.OptionParser(description="Options of specialness")
    	parser.add_option("-f", "--flags", action="store", dest="flags", default=None, help="Special flags for special people")
    	(opts,args) = parser.parse_args()
    	debug(opts)
    
    if __name__ == "__main__":
        main()
    • #!/usr/bin/env python
    • import re,sys,optparse
    • def debug(msg):
    • print("[DEBUG]: %s" % msg)
    • def main():
    • print "hello world"
    • parser = optparse.OptionParser(description="Options of specialness")
    • parser.add_option("-f", "--flags", action="store", dest="flags", default=None, help="Special flags for special people")
    • (opts,args) = parser.parse_args()
    • debug(opts)
    • if __name__ == "__main__":
    • main()
#!/usr/bin/env python


def main():
	print "hello world"

if __name__ == "__main__":
	main()