我正在使用世界时间API,希望从JSON
:{"currentDateTime":"2020-07-02T18:56-07:00"}
删除日期
我只想打印小时和分钟:18:56
以下是我到目前为止的情况:
url = 'http://worldclockapi.com/api/json/utc/now'
response = urllib.request.urlopen(url)
result = json.loads(response.read())
time = result['currentDateTime']
#testing to get everything here.
print(time)
Output here is: 2020-07-02T18:56-07:00
我尝试{
如何使用世界时钟API打印出时区没有差异的时间
谢谢
我会对这种情况做一些字符串处理
我们可以使用子字符串:
相关问题 更多 >
编程相关推荐