我当前正在编写一个不和谐的机器人,并且希望能够将今天的日期打印为dd / mm / yyyy。我尝试了 .strftime()和 .strpdate(),但是我没有找到合并 .now()的方法。 >
int s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
// bind socket to port 1 of the first available
// local bluetooth adapter
bdaddr_t bdaddrAny = {{0, 0, 0, 0, 0, 0}};
sockaddr_rc locAddr = {0, {0, 0, 0, 0, 0, 0}, 0};
locAddr.rc_family = AF_BLUETOOTH;
locAddr.rc_bdaddr = bdaddrAny;
locAddr.rc_channel = (uint8_t)1;
bind(s, (struct sockaddr *)&locAddr, sizeof(locAddr));
char addr[19] = {0};
ba2str(&locAddr.rc_bdaddr, addr);
fprintf(stderr, "BT server MAC address %s\n", addr);
这是输出:
discord.ext.commands.errors.CommandInvokeError:命令引发了异常:AttributeError:'datetime.datetime'对象没有属性'strpdate'
答案 0 :(得分:2)
from datetime import datetime
datetime.now().strftime('%d:%m:%Y')
'06:07:2020'