文章会有【原创】或者【转载】标示,部分来自Google Baidu的学习结果 {Java/PHP/Python/Ruby/Go}

Python3 学习【原创】(一)  



#-*- coding: UTF-8 -*-
"""
a = input()
if a == "8":
    print('ok')
else:
    print('no')
"""
a = ['php','ruby','houhuiyang'] #数组
for i in a:
    print(i)

b = ("hou","hui","yang") #元祖
print(b[2])

c = {'a':'php','b':'python'} #词典
for key in c:
    print(key,c[key])

#二维数组
phper_keys = ['1','2','3']
phper_vals = ['php','phper.yang','python']
arr = [phper_keys,phper_vals]
for a in arr:
    for aa in a:
        print(aa)

"""
import MySQLdb
conn = MySQLdb.connect(host="localhost",user="root",passwd="",db="hhy")
cursor = conn.cursor()
sel = cursor.execute('select * from test')
fetchone() #一条数据
fetchmany(5) #5条数据
results = cursor.fetchall() #循环列表
for i in results:
    print i;
conn.close()
"""