上一页 1 ··· 24 25 26 27 28
摘要: #$language = "VBScript"#$interface = "1.0"' This automatically generated script may need to be' edited in order to work correctly.Dim FTP_IP, FTP_User, FTP_Pass, FTP_PathFTP_IP = "10.11.44.1"'FTP_IP = "10.90.243.20"FTP_User = "mpsvr"FTP_P 阅读全文
posted @ 2011-10-13 12:10 方倍工作室 阅读(1365) 评论(0) 推荐(0) 编辑
摘要: 1: #$language = "VBScript" 2: #$interface = "1.0" 3: 4: ' This automatically generated script may need to be 5: ' edited in order to work correctly. 6: 7: Sub Main 8: 9: Dim cmd_show_chassis 10: Dim status_up, status_down 11: Dim time_minutes 12: 13: cmd_show_chassis = .. 阅读全文
posted @ 2011-10-13 12:10 方倍工作室 阅读(1275) 评论(0) 推荐(0) 编辑
摘要: #$language = "VBScript"#$interface = "1.0"crt.Screen.Synchronous = True' This automatically generated script may need to be' edited in order to work correctly.Sub Main crt.Screen.WaitForString "Username: " crt.Screen.Send "root" & chr(13) crt.Scree 阅读全文
posted @ 2011-10-13 12:09 方倍工作室 阅读(2409) 评论(0) 推荐(0) 编辑
摘要: 第十三章、 特殊的方法 1) 特殊的方法 __init__(self,...) 这个方法在新建对象恰好要被返回使用之前被调用。 __del__(self) 恰好在对象要被删除之前调用。 __str__(self) 在我们对对象使用print语句或是使用str()的时候调用。 __lt__(self,other) 当使用 小于 运算符(<)的时候调用。类似地,对于所有的运算符(+,>等等)都有特殊的方法。 __getitem__(self,key) 使用x[key]索引操作符的时候调用。 __len__(self) 对序列对象使用内建的len()函数的时候调用。 2) exec和ev 阅读全文
posted @ 2011-10-13 12:08 方倍工作室 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 第十二章、 标准库 See Python Manuals ? The Python Standard Library ? 1) sys模块 import sys if len(sys.argv) < 2: print 'No action specified.' sys.exit() if sys.argv[1].startswith('--'): option = sys.argv[1][2:] if option == 'version': print 'Version 1.2' elif option == ' 阅读全文
posted @ 2011-10-13 12:06 方倍工作室 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 第十一章、 异常 1) try/except/else格式 try: s = raw_input('--> ')except EOFError: print 'Why did you do an EOF on me?'except: print 'Error occurred.'else:print 'Done' except参数说明: except: Catch all (or all other) exception types. except name: Catch a specific exception only. 阅读全文
posted @ 2011-10-13 11:58 方倍工作室 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 第十章、 输入/输出 1) 文件poem = '''Programming is fun use Python!'''f = file('poem.txt', 'w') # open for 'w'ritingf.write(poem) # write text to filef.close() # close the file可以使用help(file)来了解详情。2) 储存器 pickle在文件中储存Python对象,cPickle(C语言,更快)import cPickle as pshopl 阅读全文
posted @ 2011-10-13 11:55 方倍工作室 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 第九章、 类与面向对象 1) 类 基本类/超类/父类被导出类或子类继承。 Inheritance继承 Inheritance is based on attribute lookup in Python (in X.name expressions). Polymorphism多态 In X.method, the meaning of method depends on the type (class) of X. Encapsulation封装 Methods and operators implement behavior; data hiding is a convention by 阅读全文
posted @ 2011-10-13 11:31 方倍工作室 阅读(442) 评论(0) 推荐(0) 编辑
摘要: 第八章、 第一个python程序#!/usr/bin/env pythonimport osimport sysimport time source = [r'G:\s1', r'G:\s2']target_dir = r'G:\d' + os.sep today = target_dir + time.strftime('%Y%m%d')now = time.strftime('%H%M%S') comment = raw_input('Enter a commnet -->')if len 阅读全文
posted @ 2011-10-13 11:24 方倍工作室 阅读(307) 评论(0) 推荐(0) 编辑
摘要: Python中有三种内建的数据结构——列表、元组和字典。 1) Lists列表 [,] 列表是序列的一种 shoplist = ['apple', 'carrot', 'banana']print shoplist #['apple', 'carrot', 'banana']shoplist.append('orange') #末尾加入一个print shoplist #['apple', 'carrot', 'banana',  阅读全文
posted @ 2011-10-13 11:23 方倍工作室 阅读(886) 评论(1) 推荐(2) 编辑
摘要: 第六章、 模块1) 模块sys模块字节编译的.pyc文件,优化编译后生成pyo文件2) from..import语句import sys print 'The command line arguments are:' for i in sys.argv: print i print '\n\nThe PYTHONPATH is', sys.path, '\n' 3) __name__只想在程序本身被使用的时候运行主块,而在它被别的模块输入的时候不运行主块from sys import * print 'The command line a 阅读全文
posted @ 2011-10-13 11:21 方倍工作室 阅读(406) 评论(0) 推荐(0) 编辑
摘要: 第五章、 函数 定义语句后面要加冒号 1) 定义函数 def sayHello(): print 'Hello World!'sayHello() 2) 变量作用域 LEGB原则 L本地作用域 E上层结构中def或lambda的作用域 G全局作用域 B内置作用域3) 工厂/闭合函数 def maker(N): def action(X): return X ** N return action f = maker(2)print f #<function action at 0x00E87730>print f(3) #9print f(4) #16g =... 阅读全文
posted @ 2011-10-13 11:19 方倍工作室 阅读(521) 评论(0) 推荐(0) 编辑
摘要: 第四章、 控制流 控制语句后面要加冒号: 1) if语句 if guess == number: print 'Congratulations, you guessed it.' # New block starts hereelif guess < number: print 'No, it is a little higher than that' # Another blockelse:print 'No, it is a little lower than that' if not False and True: #组合条件 pri 阅读全文
posted @ 2011-10-13 11:14 方倍工作室 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 第三章、 运算符与表达式 1) 运算符 + 加 - 减 * 乘 ** 幂 / 除 // 取整除 % 取模 << 左移 >> 右移 & 按位与 | 按位或 ^ 按位异或 ~ 按位翻转 < 小于 > 大于 <= 小于等于 >= 大于等于 == 等于 != 不等于 not 布尔“非” and 布尔“与” or 布尔“或”运算符优先级 建议用括号来设置优先级2) 表达式 length = 5 breadth = 2 area = length * breadth 阅读全文
posted @ 2011-10-13 11:12 方倍工作室 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 第二章、 类型常量5,1.23,9.25e-3,’This is a string’,”It’s a string!”1) 数整数:2长整数:浮点数:3.23,52.3E-4复数:-5+4j,2.3-4.6jac =-8.33 +1.2j print ac.real #-8.33 print ac.imag #1.2 print ac.conjugate() #(-8.33-1.2j) 二进制:0b1000八进制:0o307十六进制:0xFF2) 字符串单引号(')'Quote me on this'双引号(")"What's your na 阅读全文
posted @ 2011-10-13 10:29 方倍工作室 阅读(529) 评论(0) 推荐(0) 编辑
摘要: 第一章、 简介官方介绍:Python是一种简单易学,功能强大的编程语言,它有高效率的高层数据结构,简单而有效地实现面向对象编程。Python简洁的语法和对动态输入的支持,再加上解释性语言的本质,使得它在大多数平台上的许多领域都是一个理想的脚本语言,特别适用于快速的应用程序开发。安装:Python:http://www.python.org/download/PyScripter:http://code.google.com/p/pyscripter/UltraEdit的Python语法高亮:http://www.ultraedit.com/downloads/extras.htmlPython 阅读全文
posted @ 2011-10-13 10:22 方倍工作室 阅读(804) 评论(1) 推荐(1) 编辑
上一页 1 ··· 24 25 26 27 28