import pymysql
con = pymysql.connect(db='inventory', user='Masukkan user',
passwd='Masukkan Password', host='127.0.0.1', port=3306,autocommit=True)
cur=con.cursor()
cur.execute("select*from stock")
print("Stock Barang Di Gudang")
print("="*68)
print("Kode Barang Nama Barang Satuan Jumlah")
print("-"*95)
data=cur.fetchall()
j=0
for i in data:
kode_barang=i[0]
nama_barang=i[1]
satuan=i[2]
jumlah=i[3]
j+=1
print (kode_barang," "*(19-len(kode_barang)), nama_barang," "*(40-len( nama_barang)),satuan," "*(19-len(satuan)),jumlah)
print ("-"*95)
print("Total Jenis Barang Ada", j,"Jenis Barang")
print ("="*68)
cur.close()
con.close()
Note...:
Masukkan User = isi user database masing-masing...
Masukkan Password = ya masukkan password yang di database...
Kalau kurang Rapi ya dirapikan sendiri, ga tau caranya, PM aja... hihihiihhii
No comments:
Post a Comment