•        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. scala 基础知识 FAQ

    问题1: 抽象成员初始化规则 ① 父类先初始化 ② 在初始化的过程中,如果 val 发生重写,只有最后一个重写生效.前面的会变成零值,后面的会直接继承. 参考资料:https://docs.scala ...

  2. C#使用托管程序连接Oracle数据库(Oracle.ManagedDataAccess.dll)

    一.概述 Oracle Data Provider for  .NET, Managed Driver: Oracle官方的托管数据库访问组件,单DLL,Oracle.ManagedDataAcces ...

  3. Django --- 常用字段及参数

    1 ORM字段 AutoField int自增列,必须填入参数 primary_key=True.当model中如果没有自增列,则自动会创建一个列名为id的列. IntegerField 一个整数类型 ...

  4. 国赛 strange_int

    参考文章地址https://www.52pojie.cn/thread-936377-1-1.html https://qrzbing.cn/2019/04/27/CISCN2019-strange- ...

  5. C# winform Panel 添加 滚动条

    Detailed discussion here. Try this instead for 'only' scrolling vertical.(auto scroll needs to be fa ...

  6. (尚013)Vue的生命周期

    三个阶段: 一.初始化显示; 二:更新显示 三.死亡 每一个阶段都对应生命周期的回调函数(也叫勾子函数) 生命周期图示: 1. 2.test013.html <!DOCTYPE html> ...

  7. WAMP 403 Forbidden禁止访问,别的电脑访问不了;

    直接上图: 1:修改httpd.conf; deny from all 改成------ allow from all 重启服务就好了: 2:如果搜不到deny from all 就按照下面的方法来 ...

  8. 常见的 eslint 基本报错信息

    Missing semicolon 缺少分号 Missing space before opening brace 左大括号前缺少空格 Trailing spaces not allowed 不允许尾 ...

  9. 游戏服务器与客户端交互,或者与跨服交互都有消息加密方式,为什么不明文传递,加md5校验呢

    游戏服务器与客户端交互,或者与跨服交互都有消息加密方式,为什么不明文传递,加md5校验呢

  10. windows下powershell的包管理工具

    scoop github 开源地址:https://github.com/lukesampson/scoop 安装命令->powershell管理员模式下输入 Invoke-Expression ...