• [python输出]print函数


    # coding:utf-8

    # print ('abc')


    # 格式化打印


    # 整形
    # 字符串类型:  %s
    # 浮点类型

    # 字符串变量类型的格式化  %s
    # name = 'zhiliao'
    # print('my name is %s' % name)
    # %表示占位 s代表字符串类型


    # 整型变量的格式化       %d
    # age = 2147483648
    # print ('my age is %d' % age)
    # print(type(age))

    # 浮点类型变量的格式化    %f
    # price = 18.9
    # # print("apple's price is %f " % price)
    # print("apple's price is %.1f " % price)    
    #  %后面有.1 代表取一位小数   #  %后面只有.会进行四舍五入例如18.9会变成19
    # name = 'zhiliao'
    # age  = 18
    # gender = 'boy'
    # # 元组
    # print('my name is %s,my age is %d,gender is %s' %(name,age,gender))

    # 其它打印方式
    # 如果想用字符串的末尾打印一个变量,那么可以采用一下方式

    # age = 18
    # print 'my age is',age
    # print('my age is %s' % age)


    # python2版本
    # print 'hello'
    以上形式只能在python2中使用

    # python3版本
    # print('hello')
    以上形式既能在python2中使用也能在python3中使用
  • 相关阅读:
    es学习-java操作 2.4.0版本
    es学习-基础增删改查
    mongodb 查询条件
    mongodb-查询
    mysql 性能优化
    mysql 存储过程学习(总)
    MySQL 存储过程 -流程控制的使用
    MySQL 存储过程 -光标的使用
    maven的聚合和继承
    mavean的依赖传递和排除依赖
  • 原文地址:https://www.cnblogs.com/lsswudi/p/11134946.html
Copyright © 2020-2023  润新知