python - 我可以在python中命名变量 "now"吗

标签 python datetime datetime-format python-datetime

这似乎是一个幼稚的问题,但到目前为止我在网络上没有找到任何答案,我不想在我的代码中造成任何不一致的行为。

我可以在 python 代码中命名一个变量 now 吗?有一个名为 now() 的函数,这就是我怀疑的原因。

示例:

now = datetime.datetime.now()

可以将其视为存储 datetime.datetime.now() 返回值的任何普通变量吗?或者它可以在任何时候表现不同吗?

最佳答案

下面是Python中使用的关键字,除此之外你可以使用任何你想要的关键字

False      await      else       import     pass
None       break      except     in         raise
True       class      finally    is         return
and        continue   for        lambda     try
as         def        from       nonlocal   while
assert     del        global     not        with
async      elif       if         or         yield

希望能回答你的问题

关于python - 我可以在python中命名变量 "now"吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51671209/

相关文章:

javascript - 将 Web Api 返回日期时间转换为 Javascript 日期

java - 如何使用java查找纪元格式的GMT当前时间

python - 更改Python列表中的日期时间格式

python - 在 Pandas 中将列表转换为日期时间

python - pandas DataFrame 中的自定义浮点格式

python - 如何在 pandas 数据框中选择特定值并将其替换为 NaN。如何从每个 1 级多索引中删除列

mysql - 如何检查 now() 是否介于两个特定日期之间?

java.time.format.DateTimeParseException : Text 'Mi Mai 09 09:17:24 2018' could not be parsed at index 0

java - 将 SimpleDateFormat 转换为 DateTimeFormatter

python - 基于枚举参数的条件返回值类型