使用 Python 连接到 Oracle 时是否有等效于 perl fetchrow_array 的方法?
我实际上是在尝试将以下 perl 代码转换为 python 以与 cx_Oracle 一起使用...我需要创建键控字典来代替哈希,我猜(我根本不知道 perl),但首先我想将返回值转换为数组形式,以便我可以连接列。
# read the data and place into a species hash (sphash) and a data hash (tmphash)
my (@lnarr, %sphash, %tmphash, $tmpln, $tmpsel, $x, $datetime) ;
while (@lnarr = $csr->fetchrow_array) {
# $line =~ s/\s//g ; #remove spaces and newline character
# @lnarr = split /,/, $line ;
$datetime = $lnarr[4].'-'.$lnarr[5] ;
$tmpln = join '_', $lnarr[8], $lnarr[9] ;
$sphash{$lnarr[7]} = 'x';
$tmphash{$lnarr[0].'_'.$lnarr[1].'_'.$lnarr[2].'_'.$lnarr[3].'_'.$datetime.'_'.$lnarr[6]}{$lnarr[7]} .= $tmpln ;
}