•        Python : 3.7.3
  •          OS : Ubuntu 18.04.2 LTS
  •         IDE : pycharm-community-2019.1.3
  •       Conda : 4.7.5
  •    typesetting : Markdown

code

"""
@Author : 行初心
@Date : 2019/7/2
@Blog : www.cnblogs.com/xingchuxin
@Gitee : gitee.com/zhichengjiu
""" def main():
book_name = "本草纲目"
book_quantity = 1
book_price = 39.1266
book_discount = 100 # 注意输出内容前面的空白 print("""
书名:%s
数量:%d
单价:%f
折扣:%d%%
""" % (book_name, book_quantity, book_price, book_discount)) if __name__ == '__main__':
main()

result

/home/coder/anaconda3/envs/py37/bin/python /home/coder/PycharmProjects/Base/demo.py

    书名:本草纲目
数量:1
单价:39.126600
折扣:100% Process finished with exit code 0

source_code

def print(self, *args, sep=' ', end='\n', file=None): # known special case of print
"""
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
"""
pass

resource

  • [文档 - English] docs.python.org/3
  • [文档 - 中文] docs.python.org/zh-cn/3
  • [规范] www.python.org/dev/peps/pep-0008
  • [规范] zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_rules
  • [源码] www.python.org/downloads/source
  • [ PEP ] www.python.org/dev/peps
  • [平台] www.cnblogs.com
  • [平台] gitee.com


Python具有开源、跨平台、解释型、交互式等特性,值得学习。

Python的设计哲学:优雅,明确,简单。提倡用一种方法,最好是只有一种方法来做一件事。

代码的书写要遵守规范,这样有助于沟通和理解。

每种语言都有独特的思想,初学者需要转变思维、踏实践行、坚持积累。

Python3基础 print 格式化输出 %% 输出%的更多相关文章

  1. Python3基础 print 格式化输出 %f %d 保留浮点数的位数 整数的位数不够零来凑

             Python : 3.7.3          OS : Ubuntu 18.04.2 LTS         IDE : pycharm-community-2019.1.3    ...

  2. Python3基础 print与,结合 一次输出多个数据

    镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...

  3. Python3基础 print 中字符串乘以数字,重复输出多次

    镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...

  4. Python3基础 print 输出hello world

    镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...

  5. Python3基础 print , 输出多个数据

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  6. Python3基础 print 输出helloworld

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  7. Python3基础 print(,end=) 输出内容的末尾加入空格

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  8. Python3基础 print %d 输出整数

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  9. Python3基础 print \" 输出单引号与双引号

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

随机推荐

  1. 小程序基础能力~自定义 tabBar

    自定义 tabBar 基础库 2.5.0 开始支持,低版本需做兼容处理. 自定义 tabBar 可以让开发者更加灵活地设置 tabBar 样式,以满足更多个性化的场景. 在自定义 tabBar 模式下 ...

  2. head meta属性整理笔记

    最近做这个站点http://zhimo.yuanzhumuban.cc/,百度一直出现转码问题,很头疼,通过一周时间研究meta属性,达到了代码优化的效果,在此做一些笔记. <head> ...

  3. 正确robots写法,解决百度搜索不显示缩略图问题

    网站上线http://zhimo.yuanzhumuban.cc/有一年左右时间了,百度搜索显示略缩图少之又少,通过自己这几天的观察发现. 结合百度站长平台的 robots 工具和抓取诊断工具检查后, ...

  4. 阿里云部署java web

    转载请注明出处http://blog.csdn.net/evankaka 摘要:本文主要讲了如何在阿里云上安装JDK.Tomcat以及其配置过程.最后以一个实例来演示在阿里云上部署Javaweb项目. ...

  5. [DUBBO] qos-server can not bind localhost:22222错误解决

    问题描述 在启动dubbo-consumer工程时报错,信息如下: 2019-11-29 09:22:18.001 ERROR [RMI TCP Connection(2)-127.0.0.1] [o ...

  6. greenplum 表在各个节点数据的分布情况

    select gp_segment_id,count(*) from table_name group by gp_segment_id;

  7. learning armbian steps(3) ----- armbian 文件系统定制思路

    如何定制自已的armbian文件系统. 1)uboot 2)  kernel 3)  rootfs 针对linux 系统开发人员来说,真正有用的只是其armbian文件系统, 将其制作成所需的文件系统 ...

  8. 鼠标经过提高层级案例(margin,相对定位,z-index)

    <body> <ul> <li class="box1">1</li> <li class="box2"& ...

  9. C利用time函数实现简单的定时器

    //定时器 #include <stdio.h> #include <time.h> #include <stdlib.h> int main(int num, c ...

  10. AtCoder Grand Contest 021题解

    传送门 \(A\) 咕咕 ll n,res;bool fl; int main(){ scanf("%lld",&n),fl=1; while(n>9)res+=9, ...