摘要: 我们用open方法打开文件有时候会有一些问题,因为open打开文件只能写入str类型,而不会管字符串是什么编码方式。 示例: >>> fr = open('test.txt','a') >>> line1 = "我爱祖国" >>> fr.write(line1) 有编码不统一的时候,此时写入open 阅读全文
posted @ 2018-05-18 15:58 littlevigra 阅读(225) 评论(1) 推荐(0) 编辑
摘要: #!/usr/bin/env python#todo: del some elem in the listtest_list = [1,2,3,5,6,7,8,9,10,11,12]del_list = test_list[:]for i in test_list: if i % 4 == 0 an 阅读全文
posted @ 2018-05-18 12:23 littlevigra 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 让内网机器访问不通机房的机器,架构如下 (172.16.10.5) (172.17.9.109 可以出外网,开启路由转发) (内网 192.168.36.19 能ping 同9.109,但不能ping 通10.5) SNAT: iptables -t nat -I POSTROUTING -d 17 阅读全文
posted @ 2018-05-18 12:20 littlevigra 阅读(182) 评论(1) 推荐(0) 编辑
摘要: 1、useradd clouder2、解压缩mysql.tar.bz2到/home/clouder2、mv /etc/my.cnf /etc/my.cnf.bak3、/home/clouder/mysql/scripts/mysql_install_db --basedir=/home/cloude 阅读全文
posted @ 2018-05-18 11:09 littlevigra 阅读(165) 评论(1) 推荐(0) 编辑