标签:systems lock 规范 其他 blob image 基本 cti Beginner
给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。
class Solution:
# 解1
def reverse1(self, x: int) -> int:
if str(x).startswith("-"):
x = int('-' + str(x)[:0:-1])
else:
x = int(str(x)[::-1])
return x if -(2**31) < x < 2**31 - 1 else 0
# 解2
def reverse2(self, x: int) -> int:
s = (x > 0) - (x < 0)
r = int(str(s*x)[::-1])
return (s*r) * (r < 2**31)
A Beginner-Friendly Introduction to Containers, VMs and Docker
一篇入门的docker文章,介绍了VM和docker的不同点,以及在docker的各个组成部分
在使用unittest做UI自动化的时候需要对执行失败的用例进行截图,网上大多是使用装饰器的方法。最近学习到一种在tearDowm中封装的方法
def tearDown(self) -> None:???
for method_name, error in self._outcome.errors:???????
if error:???????????
case_name = self._testMethodName???????????
file_path = os.fspath(pathlib.Path.cwd().parent.joinpath('Reports', 'images', case_name + '.png'))???????????
self.driver.save_screenshot(file_path)???
self.driver.close()???
self.driver.quit()
每次运行用例时,循环遍历,有错误时进行截图,文件名为执行的用例名
Google Python Style Guide
这篇和PEP8相比是更严格的规范,按照官方的说法,这篇规范更适用于大型的项目
标签:systems lock 规范 其他 blob image 基本 cti Beginner
原文地址:https://www.cnblogs.com/felixqiang/p/12152075.html