for bt_con in bentie_content: -sharp
bt_con = re.sub("<.*?>", "", bt_con)
bt_con = re.sub("\s", "", bt_con)
if bt_con != "":
print(bt_con)
bt_cons = [bt_con]
if not huifu_id:
huifu_id = [""]
date_list = bentie_id + bentie_uid + bentie_tx + bentie_nickname + bentie_creattime + bt_cons + huifu_id
In the code, when I assign a value to date_list
, I refer to the bt_cons
variable, but when the result of the if condition is false, is there no bt_cons
variable?
tried to add else
, neither continue nor break. Later, I wanted to move this assignment to if, but. There is another if to judge, and the result of the judgment is to be assigned.
I would like to ask how to deal with this situation. The purpose is to change it to a list when bt_con
is not empty. If it is empty, this item will skip