`
诗意的栖居
  • 浏览: 268154 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
expdp介绍 数据泵工具导出的步骤: 1、创建DIRECTORY create directory dir_dp as 'D:\oracle\dir_dp'; 2、授权 Grant read,write on directory dir_dp to lttfm; --查看目录及权限 SELECT privilege, directory_name, DIRECTORY_PATH FROM user_tab_privs t, all_directories d WHERE t.table ...

sqlite3 命令

sqlite3 dbname请在db所在目录执行该命令,否则会自动创建一个新的资料库。  一、数据库基础数据表(SQLITE_MASTER) select * from SQLITE_MASTER;  通过select查询该表,该表保存数据库中保存的表结构等基础内容; 二、sqlite3特殊 ...
    持久性就是指保持对象,甚至在多次执行同一程序之间也保持对象。通过本文,您会对 Python对象的各种持久性机制(从关系数据库到 Python 的 pickle以及其它机制)有一个总体认识。另外,还会让您更深一步地了解Python 的对象序列化能力。     什么是持久性?     持久性的基本思想很简单。假定有一个 Python 程序,它可能是一个管理日常待办事项的程序,您希望在多次执行这个程序之间可以保存应用程序对象(待办事项)。换句话说,您希望将对象存储在磁盘上,便于以后检索。这就是持久性。要达到这个目的,有几种方法,每一种方法都有其优缺点。     例如,可以将对象数据存储在 ...
>>> a=[[1,2],(3,5),123,[1,2,3,4]] >>> b=copy.copy(a) >>> b [[1, 2], (3, 5), 123, [1, 2, 3, 4]] >>> b[2]=456 >>> b [[1, 2], (3, 5), 456, [1, 2, 3, 4]] >>> a [[1, 2], (3, 5), 123, [1, 2, 3, 4]] a之所以没有变,是因为b修改的是不可变对象。 拷贝了一个不可变的对象的引用, 修改你得到的变 ...
python除了关键字(keywords)和内置的类型和函数(builtins),更多的功能是通过libraries(即modules)来提供的。 常用的libraries(modules)如下: 1)python运行时服务 * copy: copy模块提供了对复合(compound)对象(list,tuple,dict,custom class)进行浅拷贝和深拷贝的功能。 * pickle: pickle模块被用来序列化python的对象到bytes流,从而适合存储到文件,网络传输,或数据库存储。(pickle的过程也被称serializing,marshalling或者flat ...
读文件时,读不到最后一行,在最后一行后面加了一行空的,就可以读到。 while read line do   echo $line fi done < $filename 办法:使用vim编辑了一下被读的文件,就可以了,不过不知道是什么原因
使用字符串指代变量名。 比如说,有两个变量 a="bbb"和bbb={"c":1},引用a如何得到{"c":1},也就是a的值'bbb'所代表的变量bbb的值。 一 exec('abc = 5') globals()['abc'] = 6 setattr(__builtins__, 'abc', 9) __import__('sys')._getframe(0).f_globals['abc'] = 27 二 a='bbb' bbb={"c":1} exec('a=%s' % a) a ...
我们在使用collection框架code时,会时常遇到UnsupportedOperationException异常,有些人很不了解为什么抛出这个异常,会很郁闷,但是那些只知道code的代码工人不会想这些问题。下面我作一下解释,可能也不是很正确。 其实我们主要 ...
字符串常用函数 replace(string,old,new[,maxsplit]) 字符串的替换函数,把字符串中的old替换成new。默认是把string中所有的old值替换成new 值,如果给出maxsplit值,还可控制替换的个数,如果maxsplit为1,则只替换第一个old值。 >>>a= ...
类型转换函数 chr(i) chr()函数返回ASCII码对应的字符串。 >>> print chr(65) A >>> print chr(66) B >>> print chr(65)+chr(66) AB ord(x) ord()函数返回一个字符串参数的ASCII码或Unicode值。 >>> ord("a") 97 >>> ord(u"a") 97 hex(x) hex()函数可把整数转换成十六进制数。 >>> hex(16) '0x1 ...
eval( expression[, globals[, locals]]) 该参数是一个字符串和可选的 globals和 locals。globals必须是一个字典。locals可以是任何映射对象. >>> x = 1 >>> print eval('x+1') 2 >>> g = {'x':'a','y':'b','z':'c'} >>> eval('x+y+z',g) 'abc' exec(str[,globals[,locals]]):exec语句参数的含义大体与eval相同。它可以接收一组语句的字符串。执 ...

No.9 Find the product abc

 
Q: A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. A: #! /usr/bin/env python #coding=utf-8 import math import ti ...
Q: Find the greatest product of five consecutive digits in the 1000-digit number. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445 ...
Q: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? A: import math import time t1 = time.time() def getNum(n):     #for i in range(2,int(n/2)):     for i in range(2,int(math.sqrt(n))+1):         if n % i == 0: ...
Q: The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 552 = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is ...
Global site tag (gtag.js) - Google Analytics