#!/usr/bin/env python import sys import os for i in sys.argv: print i print sys.argv[0] print os.path.basename(sys.argv[0].split(".")[0])
#>bin/test.py 56 555 bin/test.py 56 555 bin/test.py test
#!/usr/bin/env python import sys import os for i in sys.argv: print i print sys.argv[0] print os.path.basename(sys.argv[0].split(".")[0])
#>bin/test.py 56 555 bin/test.py 56 555 bin/test.py test
#!/usr/bin/env python import pymysql conn = pymysql.connect(host='localhost', user='root', passwd='cyrushellborg666', db='brewing') cur = conn.cursor() cur.execute("SHOW TABLES") # print cur.description # r = cur.fetchall() # print r # ...or... for r in cur: print r cur.close() conn.close()