随笔分类 -  python

摘要:python中命令行参数和shell不一样,是通过sys.argv[]来获取的,sys.argv[0]是代码文件本身的路径,因此参数是从1开始的,例子:#!/usr/bin/env pythonimport osimport jsonimport os, sys#t=os.popen("""nets... 阅读全文
posted @ 2015-02-05 16:46 cheerong 阅读(507) 评论(0) 推荐(0)
摘要:# _*_ coding: cp936 _*_ //支持中文格式import sys import getpass#admin configurationusername='cheeron'password='1234'counter = 0 #认证登录while True: if coun... 阅读全文
posted @ 2015-02-02 22:15 cheerong 阅读(767) 评论(0) 推荐(0)
摘要:[root@cheeron lesson1]# cat user.txt1 cheeron python 40998222 forilen shell 123098653 XueLi JS 43217804 LiLei IT 483930225 Simith IT 23409876 Liudehua... 阅读全文
posted @ 2015-02-01 21:27 cheerong 阅读(538) 评论(0) 推荐(0)
摘要:break结束整个循环for num in range(0,10): if num==6: break print num以上循环将会打印出0、1、2、3、4、5continue结束本次循环,立即开始下一次循环for num in range(0,10): if num==6: c... 阅读全文
posted @ 2015-01-28 22:38 cheerong 阅读(278) 评论(0) 推荐(0)
摘要:1、导入模块:import osfrom os import systemimport SocketServer as SS --别名2、使用Tab键:[root@cheeron python]# cat tab.py#python startup fileimport sysimport read... 阅读全文
posted @ 2015-01-25 21:05 cheerong 阅读(220) 评论(0) 推荐(0)