python语句的八皇后代码,摘自《Python基础教程》,代码相对于其他语言,来得短小且一次性可以打印出92种结果。同时可以扩展为九皇后,十皇后问题。 问题:在一个8*8棋盘上,每一行放置一个皇后旗子,且它们不冲突。冲突定义:同一列不能有两个皇后,每一个对角线也不能有两个皇后。当然,三个皇后...
分类:
其他好文 时间:
2014-09-15 14:07:18
阅读次数:
215
实现文件的读写#! /usr/bin/pythonfile_add = open('test.txt','a')for i in range(1,5): file_add.write("1.1.1.%d 255.255.255.255 %d 2.2.2.%d 255.255.255.1...
分类:
编程语言 时间:
2014-09-15 12:40:08
阅读次数:
245
此脚本适用于备份指定发布目录下的目录,可适当修改运用!#!/usr/bin/envpython#backupapppythonscript.importosimporttimeimportsysnowTime=time.strftime("%Y%m%d")sourcePath=‘/home/zcb/resin-4.0.10/apps/‘backupPath=‘/home/zcb/tmp/bak‘+nowTimeifnotos.path.exists(‘/h..
分类:
编程语言 时间:
2014-09-15 11:29:19
阅读次数:
266
第03章: 使用字符串
------
支持的操作
索引
切片
增加元素
删除元素
更新元素
查找元素(检查某个元素是否是序列中的一员)
序列长度
最大值
最小值
其他内建函数...
分类:
编程语言 时间:
2014-09-15 06:38:48
阅读次数:
236
原题地址:http://oj.leetcode.com/problems/swap-nodes-in-pairs/Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2...
分类:
编程语言 时间:
2014-09-15 06:38:18
阅读次数:
200
以前所用的操作系统是centos,如今用的操作系统是debian,所以开始适应,转变。debian安装之后发现默认没有安装ssh,所以先安装ssh服务并启动apt-getinstallssh
/etc/init.d/sshstart接下来安装pexpect,paramiko模块。若要安装上面的模块,先安装setuptools模块。安装setuptoo..
分类:
编程语言 时间:
2014-09-15 03:28:08
阅读次数:
192
原题地址:https://oj.leetcode.com/problems/reverse-linked-list-ii/题意:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Gi...
分类:
编程语言 时间:
2014-09-14 23:38:47
阅读次数:
239
原题地址:https://oj.leetcode.com/problems/add-two-numbers/题意:You are given two linked lists representing two non-negative numbers. The digits are stored i...
分类:
编程语言 时间:
2014-09-14 23:17:17
阅读次数:
292