随笔分类 -  Python

摘要:(Study_env) ➜ DAL python -c "import cx_Oracle"Traceback (most recent call last): File "<string>", line 1, in <module>ImportError: dlopen(/Code_Depot/S 阅读全文

posted @ 2016-08-18 08:30 NooBkey 阅读(481) 评论(0) 推荐(0) |

摘要:设置NLS_LANG环境变量 import os os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8' 阅读全文

posted @ 2016-08-02 15:42 NooBkey 阅读(568) 评论(0) 推荐(0) |

摘要:#!/usr/bin/env python #coding:utf-8 ''' Created on 2015年12月8日 @author: DL @Description: 使用二分法查找mobile文件中区号归属地 ''' import os import sys class SearchAreacode(object): def __init__(self,file... 阅读全文

posted @ 2016-07-27 14:41 NooBkey 阅读(190) 评论(0) 推荐(0) |

摘要:为避免在模板中使用URL的硬编码,可以使用{% url %}模板标签来解决 阅读全文

posted @ 2016-07-13 11:09 NooBkey 阅读(224) 评论(0) 推荐(0) |

摘要:#!/usr/bin/python2.7#coding:utf8import sysimport jpypeimport os.path phone_num = sys.argv[1]#jarpath = os.path.join(os.path.abspath('.'), 'build/jar') 阅读全文

posted @ 2016-07-04 12:41 NooBkey 阅读(4410) 评论(0) 推荐(0) |

摘要:把fonts.googleapis.com替换为fonts.useso.com即可 阅读全文

posted @ 2016-06-28 20:06 NooBkey 阅读(523) 评论(0) 推荐(0) |

摘要:我们需要对List、Dict进行排序,Python提供了两个方法对给定的List L进行排序,方法1.用List的成员函数sort进行排序,在本地进行排序,不返回副本方法2.用built-in函数sorted进行排序(从2.4开始),返回副本,原始输入不变 sorted >>> help(sorte 阅读全文

posted @ 2016-06-02 13:29 NooBkey 阅读(255) 评论(0) 推荐(0) |

摘要: 阅读全文

posted @ 2016-06-01 09:27 NooBkey 阅读(121) 评论(0) 推荐(0) |

摘要:在是用freeswitch时利用ESL的python调用时传递字符串报错 修改文件esl_wrap.cpp ##### /* for C or C++ function pointers *///添加定义#define SWIG_InternalNewPointerObj(ptr, type, fl 阅读全文

posted @ 2016-05-23 02:02 NooBkey 阅读(1042) 评论(0) 推荐(0) |

摘要:os.environ['TZ'] = 'Asia/Shanghai' os.environ['TZ'] = 'Europe/London' hour_cur = time.strftime('%H') 阅读全文

posted @ 2016-04-14 11:17 NooBkey 阅读(817) 评论(0) 推荐(0) |

摘要:locals()返回一个包含当前作用域里面的所有变量和它们的值的字典。 所以可以把views改写为 def current_datetime(request): current_date = datetime.datetime.now() return render_to_response('cur 阅读全文

posted @ 2016-03-01 09:02 NooBkey 阅读(414) 评论(0) 推荐(0) |

摘要:模板中通过变量替代key取字典内容 templatetags/├── get_item.py├── __init__.py ###get_item.py # coding=utf-8 from django import templatefrom django.utils.safestring im 阅读全文

posted @ 2016-02-18 13:00 NooBkey 阅读(2985) 评论(0) 推荐(0) |

摘要:$('#uncheckAll').click(function(){ var chart = $('#container').highcharts(); var series = chart.series; for(i=0; i < chart.series.length; i++) { serie 阅读全文

posted @ 2016-02-18 12:53 NooBkey 阅读(779) 评论(0) 推荐(0) |

摘要:tooltip: { valueSuffix: '%', formatter:function(){ return''+this.series.name+' '+Highcharts.numberFormat(this.y,2,'.')+' %';} }, 阅读全文

posted @ 2016-02-18 12:52 NooBkey 阅读(2196) 评论(0) 推荐(1) |

摘要:1.将字符串的时间转换为时间戳 方法: a = "2013-10-10 23:40:00" 将其转换为时间数组 import time timeArray = time.strptime(a, "%Y-%m-%d %H:%M:%S") ... 阅读全文

posted @ 2015-11-10 09:31 NooBkey 阅读(250) 评论(0) 推荐(0) |

摘要:python下的setuptools带有一个easy_install的工具,在安装python的每三方模块、工具时很有用,也很方便。安装setuptools前先安装pip,请参见《python下pip的安装》1. 下载:在它的官网可以下载到安装包:https://pypi.python.org/py... 阅读全文

posted @ 2015-10-19 13:30 NooBkey 阅读(1292) 评论(0) 推荐(0) |

摘要:有时候,为了需求,需要统计两个 list 之间的交集,并集,差集。查询了一些资料,现在总结在下面:1. 获取两个list 的交集#方法一:a=[2,3,4,5]b=[2,5,8]tmp=[valforvalinaifvalinb]printtmp#[2,5]#方法二printlist(set(a).... 阅读全文

posted @ 2015-10-16 16:06 NooBkey 阅读(555) 评论(0) 推荐(0) |

摘要:下载LOFTER客户端1、首先安装SVN这个软件apt-get install subversion2、在home目录下创建一个名为svn的文件夹(文件夹的名字随便起)mkdir /home/svn3、创建数据仓库(可以根据需要创建多个)svnadmin create /home/svn/test... 阅读全文

posted @ 2015-10-03 15:29 NooBkey 阅读(249) 评论(0) 推荐(0) |

摘要:#!/usr/bin/env python# -*- coding: utf-8 -*- import randomimport string#第一种方法seed = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@... 阅读全文

posted @ 2015-09-17 10:09 NooBkey 阅读(502) 评论(0) 推荐(0) |

摘要:对于str类型,python并没有reverse函数。然而,通过反向步进切片,我们可以高效地反转一串字符串。s='abcde's[::-1] 阅读全文

posted @ 2015-09-17 09:42 NooBkey 阅读(202) 评论(0) 推荐(0) |

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3