python: excel 换行符(_x000D_)

data4 = dataframe1.loc[4:34]
for idx, datavalue in data4.iterrows():
    #strnum=Common.Utils.Utils.getAnnualLeave(data)
    print("[{}]: {}".format(idx, datavalue))
    slist=datavalue.tolist()
    hbll=BLL.EmpLoyeeHolidaysGet.EmpLoyeeHolidaysGet() #病假4小時_x000D_事假0.5小時 未处理
    #print(slist)
    for i in range(len(slist)):
        #strvalue=str(slist[i]).replace(r'\s+|\\n', ' ', regex=True)  _x000D_
        strvalue = str(slist[i]).replace('_x000D_', ' ')  # 规换单元格的换行符,否则处理不了正确数据
        strnums = hbll.getHolidays(strvalue)  # float str
        for sn in range(len(strnums)):
              print("str:",strnums[sn].HolidayName,strnums[sn].WorkTime)
 
    print("类型:",type(datavalue))
print("*************")

你可能感兴趣的:(Python,python,开发语言)