简明Python核心内容

  1. 字面变量(literal Constants):数字,字符串都是,值不能被改变。
  2. 格式化方法:“{},{}两个空格”.format(name,age)."{0:.3f}".format(1.0/3)保留小数点后三位小数。print(0:._^11).format("hello")输出___hello___,_^10为__heloo___.6^11:66hello666.
  3. print总会另起一行,\n.要想输出内容连续结尾加end=”“。print(”a“,end="").逗号也省略
  4. 转义字符,What's your name,可以描述为Whta\s your name.如果是描述\,那么需要写成\\.
  5. \n为新一行继续,

猜你喜欢

转载自blog.csdn.net/weixin_42199275/article/details/81629704