原创 python優化 id()函數

>>> a = 2.5>>> b = 2.5>>> c = b>>> a is cFalse>>> a = 2>>> b = 2>>> c = b>>> a is cTrue在使用is函數的時候去打印a,b分別被賦值爲2.5 和2的情況,發

原创 select 多字段去重

selelct distinct 字段一,字段二,字段三…… from 表distinct 只能返回他的目標字段,所以這條語句是根據它後面的所有字段進行去重。如果我們只根據一個字段去重,而打印出其他字段怎麼辦呢?select  字段一, d

原创 Python模塊學習——optparse

Python 有兩個內建的模塊用於處理命令行參數:一個是 getopt,《Deep in python》一書中也有提到,只能簡單處理 命令行參數;另一個是 optparse,它功能強大,而且易於使用,可以方便地生成標準的、符合Unix/Po

原创 scrapy 爬蟲

添加user-agent : setting中添加 USER_AGENT = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom

原创 vmware:Cannot open the disk 'XXX' or one of the snapshot disks it depends on.

vmware:Cannot open the disk 'XXX' or one of the snapshot disks it depends on. reason: failed to lock the file.今天打開vmware

原创 Python特殊語法:filter、map、reduce、lambda [轉]

filter(function, sequence):對sequence中的item依次執行function(item),將執行結果爲True的item組成一個List/String/Tuple(取決於sequence的類型)返回:>>>

原创 linux 批量文件重命名

centos 6.6  mv  rename  都不能滿足需求所有文件名格式如下:[[email protected]][1442146016999][<[email protected]>][callc

原创 zookeeper配置kerberos認證的坑

zookeeper配置了kerberos之後,zkCli.sh 連接認證死活不通過連接命令: zkCli.sh報錯如下:WatchedEvent state:SyncConnected type:None path:null 2017-08

原创 python xrange比range性能更好

range    函數說明:range([start,] stop[, step]),根據start與stop指定的範圍以及step設定的步長,生成一個序列。range示例: >>> range(5) [0, 1, 2, 3, 4] >>>

原创 我的友情鏈接

51CTO博客開發

原创 eclipse下提交job時報錯mapred.JobClient: No job jar file set. User classes may not be found.

windows下,連接遠程集羣,直接在eclipse裏運行mapreduce作業時,錯誤信息:11/10/14 13:52:07 WARN mapred.JobClient: Use GenericOptionsParser for par

原创 ImportError: No module named items

spiders 目錄中的.py文件不能和項目名同名。

原创 hive distict 和 count 操作reducer只有一個的問題

select count(distinct *) from table;這樣寫會生成一個job 只有一個reducer執行,可以改爲如下:select count(*) from (select distinct * from table)

原创 Hive group by操作後將其他字段串接

表tmp_testa iosb andrioda andriod目標數據a ios|andriodb andriodsql: select uid,concat_ws('|', collect_set(device)) from tmp_t

原创 vmware:Cannot open the disk 'XXX' or one of the snapshot disks it depends on.

vmware:Cannot open the disk 'XXX' or one of the snapshot disks it depends on. reason: failed to lock the file.今天打開vmware