从网上找了个在线的文档 http://www.runoob.com/python/python-tutorial.html html
就按照上面的例子学起来了,不过我开始学的是python3.5.1,不知道是否是太新了。python
如下是第一天本身练习的简单内容,固然是按照文档写的例子,不过有的格式会有些不同this
#!/usr/bin/pythonspa
# -*- coding:UTF-8 -*-code
# filename:test.pyhtm
#element
#part onejade
if True:文档
print ("Answer")get
print ("True")
else:
print ("Answer")
print ("False")
#part 2
print ("hello python"); #the first note
#PART 3
input("\n\nPress the enter key to exit.")
#part 4
import sys; x='foo';sys.stdout.write(x + '\n')
#part 5
counter = 100 #zheng xing
miles = 1000.0 # fudianxing
name = "John" #zifuchuan
print (counter)
print (miles)
print (name)
str = "what\'s hello world"
print (str)
print (str[0]) #OUTPUT the first character
print (str[2:5]) #output from the third to the fifth
print (str[2:]) # output from the third character
print (str*2) #output the str twice
print (str + 'test') # output the connected str
list=['abcd',786,2.33,'jade',19.3]
tinylist=[124,'jade']
print (list) # output list
print (list[0]) # output the first element
print (list[1:3]) #output from the second to the third
print (list[2:]) #output from the third to the last one
print (tinylist*2) # output twice
print (tinylist+list) #
tuple=('abdc',100,1.1,'jade',13.1)
list=['abcd',100,1.1,'jade',13.1]
#tuple[2]=1000 #this is a wrong grammar
list[2]=1000
print (tuple)
print (list)
dict = {}
dict['one'] = "this is one"
dict[2] = "this is two"
tinydict = {'name':'john','code':6734,'dept':'sales'}
print (dict['one'])
print (dict[2])
print (tinydict)
print (tinydict.keys())
print (tinydict.values())