对比学习Python与C
str1 = 'hello python 2'
# 字符串
i = 3.1415926535 print(str1)
print("hello python\n")
# print 自带换行符
print('%s'%str1)
print(str1)
print("你好,%s OK %d" % (str1, i))
##格式化打印到标准输出 print("%.2f\t%.4f" % (i, i))
 
输出:

hello python 2
hello python

hello python 2
hello python 2
你好,hello python 2 OK 3
3.14    3.1416

Python Date 1–Hello world print的更多相关文章

  1. Python date,datetime,time等相关操作总结

    date,datetime,time等相关操作总结   by:授客 QQ:1033553122 测试环境: Python版本:Python 3.3.2 代码实践: __author__ = '授客' ...

  2. Python 3.x下消除print()自动换行

    Python 2.x下的print语句在输出字符串之后会默认换行,如果不希望换行,只要在语句最后加一个“,”即可.但是在Python 3.x下,print()变成内置函数,加“,”的老方法就行不通了. ...

  3. 【Python】【BugList12】python自带IDLE执行print(req.text)报错:UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 93204-93204

    [代码] # -*- coding:UTF-8 -*- import requests if __name__ == '__main__': target = 'https://unsplash.co ...

  4. python date time

    //test.py import time ticks = time.time()print tickslocaltime = time.localtime(time.time())print loc ...

  5. python logging模块,升级print调试到logging。

    简介: 我们在写python程序的时候,很多时候都有bug,都是自己写的,自己造的孽,又的时候报错又是一堆,不知道是那部分出错了. 我这初学者水平,就是打print,看哪部分执行了,哪部分没执行,由此 ...

  6. Python 2.7 中使用 Print 方法

    print ("test",file=name)类似的方法在python 2中需要先引入 __future__才可使用 import __futhure__ import prin ...

  7. Python输入input、输出print

    1.输入input input是用于输入数据给变量.通过键盘输入的是字符串,如果需要其他格式,需要做转换.比如int.float类型数据,int() 如下是一个例子: 如果a不进行int转换,那么输入 ...

  8. Python:Python2和3不同print汉字方式

    Python3: 可以直接通过print('你好')输出 Python2: 需在开头加#encoding=UTF-8 不过之前输出的时候即使加了开头一行,也是一些混乱的汉字,一看就知道编码错误,后来我 ...

  9. Python内置函数(57)——print

    英文文档: print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False) Print objects to the text str ...

随机推荐

  1. Android 将时间戳转为代表"距现在多久之前"的字符串

    public String getStandardDate(int dateTime) { StringBuffer sb = new StringBuffer(); long t = Long.pa ...

  2. Android存储Json到本地,和读取本地Json

    /** * 保存json到本地 * @param mActivity * @param filename * @param content */ public static File dir = ne ...

  3. jquery如何把一个html元素替换成另外一个html元素?

    1.replaceWith( )   使用括号内的内容替换所选择的内容.              $("#div").replaceWith("<p id=&qu ...

  4. Python全栈day9(Python基础)

    Python基础 一,Windows安装Python3.5 下载地址:https://www.python.org/ftp/python/3.5.2/python-3.5.2rc1-amd64.exe ...

  5. The Personal Touch Client Identification 个性化接触 客户识别

    w服务器要知道和谁在交谈. HTTP The Definitive Guide Web servers may talk to thousands of different clients simul ...

  6. python学习笔记(二)— 字典(Dictionary)

    字典是另一种可变容器模型,且可存储任意类型对象.字典是无序的,因为它没有下标,用key来当索引,所以是无序的. 字典的每个键值(key=>value)对用冒号(:)分割,每个对之间用逗号(,)分 ...

  7. 剑指Offer——对称的二叉树

    题目描述: 请实现一个函数,用来判断一颗二叉树是不是对称的.注意,如果一个二叉树同此二叉树的镜像是同样的,定义其为对称的. 分析: 递归解法. 如果对称点一个有一边为空一边不为空,或者是对称点数值不一 ...

  8. MySQL优化(二):SQL优化

    一.SQL优化 1.优化SQL一般步骤 1.1 查看SQL执行频率 SHOW STATUS LIKE 'Com_%'; Com_select:执行SELECT操作的次数,一次查询累加1.其他类似 以下 ...

  9. 012-HQL中级2-Hive如何执行文件中的sql语句

    Hive可以运行保存在文件里面的一条或多条的语句,只要用-f参数,一般情况下,保存这些Hive查询语句的文件通常用.q或者.hql后缀名,但是这不是必须的,你也可以保存你想要的后缀名.假设test文件 ...

  10. db-mysql-001- 语句备份表

    1.备份表 CREATE TABLE AAbak( SELECT * FROM AA ); 2.两个已存在表导数据 INSERT INTO AAbak(c1,c2) SELECT c1,c2 FROM ...