首页 > 其他分享 >Test_Moduel AA0002

Test_Moduel AA0002

时间:2023-03-08 11:13:40浏览次数:45  
标签:输出 AA0002 format print 40 Moduel Test y1 x1

 1 # 使用字符串的format()方法,对输出数据项进行格式化
 2 x1, y1 = 1.2, 3.57
 3 x2, y2 = 2.26, 8.7
 4 # 输出1
 5 print('{:-^40}'.format('输出1')) # {:-^40}控制输出数据格式: 宽度占40列,居中对齐,空白处用-补齐
 6 print('x1 = {}, y1 = {}'.format(x1, y1))
 7 print('x2 = {}, y2 = {}'.format(x2, y2))
 8 # 输出2
 9 print('{:-^40}'.format('输出2')) # {:-^40}控制输出数据格式: 宽度占40列,居中对齐,空白处用-补齐
10 print('x1 = {:.1f}, y1 = {:.1f}'.format(x1, y1)) # {:.1f}控制小数输出精度,保留1位小数
11 print('x2 = {:.1f}, y2 = {:.1f}'.format(x2, y2))
12 # 输出3
13 print('{:-^40}'.format('输出3')) # {:-^40} 控制输出数据格式: 宽度占40列,居中对齐,空白处用-补齐
14 print('x1 = {:<15.1f}, y1 = {:<15.1f}'.format(x1, y1)) # {:<15.1f}控制数据输出宽度占15列,小数部分占1列,左对齐,空白处默认补空格
15 print('x2 = {:<15.1f}, y2 = {:<15.1f}'.format(x2, y2))
16 # 输出4
17 print('{:-^40}'.format('输出3')) # {:-^40} 控制输出数据格式: 宽度占40列,居中对齐,空白处用-补齐
View Code

 

标签:输出,AA0002,format,print,40,Moduel,Test,y1,x1
From: https://www.cnblogs.com/Luke-FOX-31415926/p/17191260.html

相关文章

  • 使用TestFlight安装ios SwichBot的测试版本
    一、版本链接https://testflight.apple.com/join/1UYD4l6X二、获取TestFlightApp在链接里点击第一步下面的按钮,跳转到TestFlight下载。 下载完毕后,回到链接。......
  • pytest some
    importparamikoimporttimeimportallurefromselfimportselfimportpytestclassSSLConnection:defrun(self,ssh,command):stdin,stdout,s......
  • SMU Spring 2023 Trial Contest Round 2
    A-生活大爆炸版石头剪刀布B-联合权值C-飞扬的小鸟D-无线网络发射器选址E-寻找道路F-廊桥分配G-格雷码A-生活大爆炸版石头剪刀布这套题就是注意处......
  • AtCoder Beginner Contest 292-C D E
    C.FourVariables从正整数中,找出合适的ABCD,使得这个式子成立\(AB+CD=N\)。可以看到,A与B是相互关联的,C与D是相互关联的,所以我们可以在小于N的正整数中,找寻可以相加的两个......
  • ITLES Test Planning
     LeadingVideos:导引VocabularybuildingOther:538考点词 提取码:q44z Speaking???ListeningOther:王陆语料库 提......
  • python unittest
    shttps://docs.python.org/zh-cn/3.10/library/unittest.htmlhttps://softdown02.rbread05.cn/down/unittest2-0.5.1.tar.zip 一、unittest编写规范1、unittest ......
  • PyUint测试框架:unittest
    unittest是python的内置模块,支持自动化测试,测试用例间可共享setUp(测试前的初始化)以及测试后的清理工作terDown,可以将测试用例合并为集合执行,然后输出测试报告1基本概......
  • pytest - 结合 allure 报告
    修改报告内fixture方法名展示@allure.title("我是fixture")defsetup_session(autouse=True,scope="session")print("setup")yieldprint("teardown")......
  • 搞定Go单元测试(三)—— 断言(testify
    在上一篇,介绍了表格驱动测试方法和gomock测试框架,大大提升了测试效率与质量。本篇将介绍在测试中引入断言(assertion),进一步提升测试效率与质量。为什么需要断言库我们先来......
  • python-unittest(部分笔记)
    自带的单元测试框架:创建一个类,必须继承单元测试用例的类——(unittest.TestCase)单元测试的两部分: ①代码级别的功能验证          ②逻辑覆盖单元测试框架......