基础语法

#!/usr/bin/env python

s1,s2 = "hello","world"
print s1, s2 # 'hello world'
print s1 + s2 # 'helloworld'

port = 22
print "service port is", port
print "service port is " + str(port) # must convert int to string

dir(s1)
dir(port)

help(s1.split)

s = "I Love Python"
st = s.split(' ')
print st
kw = "Python"
kw in s # True

'''
1
2
3
'''
for i in [1,2,3]:
    print i

# '1 2 3'
for i in [1,2,3]:
    print i,

results matching ""

    No results matching ""