小编Jam*_*sPy的帖子

Python xlrd使用日期转换将Excel xlsx解析为csv

我试图将Excel.xlsx文件解析为csv文件.这是Excel文件:

Date         Person 1     Person 2  
02/03/2015   Bob          James A       
03/03/2015   Billy        Nic       
04/03/2015   Sally        Mark      
05/03/2015   Alan         James A       
06/03/2015  James W       James A
Run Code Online (Sandbox Code Playgroud)

我的Python脚本:

import xlrd
import csv

book = xlrd.open_workbook('rota.xlsx')

sheet = book.sheet_by_name('Sheet1')

csvfile = open('output.csv', 'wb')
wr = csv.writer(csvfile, quoting=csv.QUOTE_ALL)

for rownum in range(sheet.nrows):
  wr.writerow(sheet.row_values(rownum))

csvfile.close()
Run Code Online (Sandbox Code Playgroud)

但它输出这样的日期:

Date,Person1,Person2
41884,Bob,James B
41885,Billy,Nic
41886,Sally,Mark
41887,Alan,James A
41888,James W,James A
Run Code Online (Sandbox Code Playgroud)

我知道xldate_as_tuple函数或类似的东西将输出转换为有意义的值,但我无法弄清楚如何使用它.任何帮助,我将非常感激.

python csv xlrd python-2.7

5
推荐指数
1
解决办法
4243
查看次数

PHP oci8无法通过pecl安装:“严重错误:oci8_dtrace_gen.h”

我试图将我的fedora 25网络服务器-php连接到Oracle数据库。

为此,我需要pecl安装oci8。

但是我得到这个错误:

/bin/sh /var/tmp/pear-build-roottqYEC6/oci8-2.1.4/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-roottqYEC6/oci8-2.1.4/include -I/var/tmp/pear-build-roottqYEC6/oci8-2.1.4/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/12.1/client64  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8.c -o oci8.lo
libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-roottqYEC6/oci8-2.1.4/include -I/var/tmp/pear-build-roottqYEC6/oci8-2.1.4/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/12.1/client64 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8.c  -fPIC -DPIC -o .libs/oci8.o
In file included from /var/tmp/oci8/oci8.c:49:0:
/var/tmp/oci8/php_oci8_int.h:46:29: fatal error: oci8_dtrace_gen.h: No such file or directory
 #include "oci8_dtrace_gen.h"
                             ^
compilation terminated.
Makefile:196: recipe for target 'oci8.lo' failed
make: *** …
Run Code Online (Sandbox Code Playgroud)

php lamp pdo oci8 fedora-25

2
推荐指数
2
解决办法
7836
查看次数

标签 统计

csv ×1

fedora-25 ×1

lamp ×1

oci8 ×1

pdo ×1

php ×1

python ×1

python-2.7 ×1

xlrd ×1