上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页
摘要: 都是用Ubuntu16.04系统,直接使用sudo apt-get install mysql 安装好数据库就好。 主库:192.168.3.191从库:192.168.3.193 1. 开启mysqllogbinvi /etc/mysql server-id = 1 # 2台mysql要设置不同的 阅读全文
posted @ 2019-05-20 10:37 hejp 阅读(144) 评论(0) 推荐(0) 编辑
摘要: import shutil with open('/etc/passwd', 'rb') as sfobj: with open('/tmp/mima.txt', 'wb') as dfobj: shutil.copyfileobj(sfobj, dfobj) # 拷贝文件对象 shutil.copyfile('/etc/passwd', '/tmp/mima2.tx... 阅读全文
posted @ 2019-05-20 10:02 hejp 阅读(117) 评论(0) 推荐(0) 编辑
摘要: print("%s is %s years old" % ('bob', 23)) # 常用 print("%s is %d years old" % ('bob', 23)) # 常用 print("%s is %d years old" % ('bob', 23.5)) # %d是整数 常用 print("%s is %f years old" % ('bob', 23.5)) pri... 阅读全文
posted @ 2019-05-17 17:28 hejp 阅读(201) 评论(0) 推荐(0) 编辑
摘要: py_str = 'hello world!' print(py_str.capitalize()) # 第一个字母大写 print(py_str.title()) # 首字母大写 print(py_str.center(50)) # 字符串放50空格中间 print(py_str.center(50, '#')) # 字符串放50个*的中间 print(py_str.ljust(50, ... 阅读全文
posted @ 2019-05-17 17:16 hejp 阅读(280) 评论(0) 推荐(0) 编辑
摘要: alist = [10,'john'] for ind in range(len(alist)): print('%s: %s' %(ind, alist[ind])) for item in enumerate(alist): print('%s: %s' % (item[0], item[1])) for ind, val in enumerate(alist): ... 阅读全文
posted @ 2019-05-17 17:06 hejp 阅读(132) 评论(0) 推荐(0) 编辑
摘要: from random import randint # randint用于生成一个指定范围内的整数 alist = list() print(list('hello')) print(list((10,20,30))) astr = str() print(str(10)) print(str(['h','e','l','l','o'])) atuple = tuple() print(... 阅读全文
posted @ 2019-05-17 15:01 hejp 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 思路:1、设置一个用于随机取出字符的基础字符串,本例使用大小写字母加数字。2、循环n次,每次随机取出一个字符。3、将各个字符拼接起来,保存到变量result中。 阅读全文
posted @ 2019-05-17 14:50 hejp 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 每一个以py作为扩展名的文件都是一个模块。 结果输出: 阅读全文
posted @ 2019-05-17 14:41 hejp 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 一、概述1、什么是数据库 ? 答:数据的仓库,如:在ATM的示例中我们创建了一个 db 目录,称其为数据库 2、什么是 MySQL、Oracle、SQLite、Access、MS SQL Server等 ? 答:他们均是一个软件,都有两个主要的功能: a. 将数据保存到文件或内存 b. 接收特定的命 阅读全文
posted @ 2019-05-16 15:38 hejp 阅读(131) 评论(0) 推荐(0) 编辑
摘要: def mtable(n): # 定义一个函数 for i in range(1, n + 1): for j in range(1, i + 1): print('%s*%s=%s' % (j, i, i * j), end=' ') print() mtable(3) mtable(5) 结果输出: 阅读全文
posted @ 2019-05-16 15:18 hejp 阅读(449) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页