zoukankan      html  css  js  c++  java
  • python学习记录

    1. print()函数

    默认形式:print (value, ... value, sep=' ', end=' n ', file=sys.stdout , flush=False)

    value:表示输出的值;sep=' ':表示value和value之间用' '间隔;end=' n ':表示最后一个value后追加换行符;file=sys.stdout:表示输出至屏幕;flush=False:表示输出缓存关闭。

    升级形式:

    a='Hello'
    b='World'
    f=open("helloworld.txt","w")
    print(a,b,sep='|',end='',file=f,flush=False)
    f.close()

    输出到一个txt的文件中:Hello|World!

    2.数值类型

    在Python 3.x中 整型不用区分short,int,long

    Python 3.x 允许为数值(包括浮点型)增加下画线作为分隔符:1_000_000=1000000

    3.字符串

    字符串既可用单引号括起来,也可用双引号括起来,没有任何区别。

    bytes型字符串

    4.类型转换

    str(),repr()将数值转换成字符串

  • 相关阅读:
    查看web访问日志各url shell
    分页公式
    编译hadoop2.6.0源码
    淘宝微信支付
    nodejs hot deployment
    nwjs
    css小技巧
    webpack babel 相关文章
    nodejs web framework
    swiper
  • 原文地址:https://www.cnblogs.com/f-t-q/p/11542765.html
Copyright © 2011-2022 走看看