苑黎

导航

 

sys.argv从程序外部获取参数的桥梁      sys.argv[0]程序本身,如test.py

rstrip()删除字符串末尾的特定字符(默认为空格)

strip()用于去除头尾制定的字符串

 os.system()函数的命令直接可执行linux的命令

>>> import os

>>> a=os.system('ls')

test1.py

>>> a=os.system('pwd')

/GPFS01/home/niyl/python/WES_test/test

 

os.popen函数和os.system不太一样

>>> b=os.popen('ls')
>>> b
<open file 'ls', mode 'r' at 0x7f7d3988b5d0>

>>> b.read()
'test1.py\n'

startswith() 方法用于检查字符串是否是以指定子字符串开头,如果是则返回 True,否则返回 False。如果参数 beg 和 end 指定值,则在指定范围内检查。

str.startswith(str, beg=0,end=len(string));

posted on 2017-07-31 15:52  苑黎  阅读(437)  评论(0编辑  收藏  举报