第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Python 工作表.write 將 2 列連接成 1 列

Python 工作表.write 將 2 列連接成 1 列

紫衣仙女 2022-08-11 17:52:21
我有2列:日期用戶我試圖將兩列連接起來(lái),最終只有一列,如下所示:日期/用戶但是我不確定在使用Python工作表時(shí)如何執(zhí)行此操作。這里有人有這個(gè)班級(jí)的經(jīng)驗(yàn)嗎?當(dāng)然,對(duì)于已經(jīng)使用過(guò)此類(lèi)的用戶來(lái)說(shuō),這應(yīng)該是一個(gè)簡(jiǎn)單的解決方案import xlsxwriterworksheet.write('A' + str(x), unicode(Date , 'utf-8'), headerBorderFormat)worksheet.write('B' + str(x), unicode(Username, 'utf-8'), headerBorderFormat)worksheet.write('C' + str(x), unicode(Date + ' / ' + Username, 'utf-8'), headerBorderFormat)# get and display one row at a time.for row in details:    x += 1    worksheet.write('A' + str(x), row[0], dateFormat)    worksheet.write('B' + str(x), row[1], tableDataFormat)    #here I have to concat row[0] + ' / ' + row[1]workbook.close()
查看完整描述

1 回答

?
慕田峪9158850

TA貢獻(xiàn)1794條經(jīng)驗(yàn) 獲得超8個(gè)贊

如果 s 的第一個(gè)元素是 datetime 對(duì)象,第二個(gè)元素是字符串,則當(dāng)您為日期提供所需的格式時(shí),類(lèi)似下面的字符串可能會(huì)起作用(請(qǐng)參閱 https://strftime.org/):row


# single column header:

col_name = unicode(Date , 'utf-8') + ' / ' + unicode(Username, 'utf-8')

worksheet.write('A' + str(x), col_name, headerBorderFormat)


# get and display one row at a time.

for row in details:

    x += 1

    format = '%Y%m%d'

    cell_content = row[0].strftime(format) + ' / ' + row[1]

    worksheet.write('A' + str(x), cell_content, tableDataFormat)


查看完整回答
反對(duì) 回復(fù) 2022-08-11
  • 1 回答
  • 0 關(guān)注
  • 126 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)