python 基础

#!/usr/bin/env python

for a in [1,2]:

 for b in ['a','b']:

    print a,b



import os

if os.path.isdir("/tmp"):

 print "/tmp is a direcotry"

else:

 print "/tmp is not a direcotry"



class server(object):

 def _init_(self,ip,hostname):

 self.ip=ip

 self.hostname=hostname



ipython

import subprocess

subprocess.call(["ls","-l"])



调用函数 xx()

你可能感兴趣的:(python 基础)