对比学习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. Transact-SQL小知识

    一.Isnull 函数 Isnull 函数主要作用是将为空的值替换为指定值,如果不为空返回检查类型的返回值,isnull的语法: Isnull (check_expression , replacem ...

  2. Imageview如何设置背景颜色

    ImageView.setBackgroundColor(android.graphics.Color.parseColor("#ffffff")); ImageView.setB ...

  3. js 跨域 之 修改服务器配置-XAMPP-Apache (nginx 拉到最后!)

    js高程第21章提到了ajax 跨域技术,方法有很多,如图: 我主要讲这个: 其实代码就是这样就好了,当然只兼容 IE9 及之后的版本 ,IE9 之前的版本请去原书看吧,Page 600 var xh ...

  4. Vue.js_构造器及其实例化概念

    Vue构造器 1.Vue.js是一个构造函数,编程中称之为构造器 2.每一个new Vue() 都是一个Vue构造函数的实例,这个过程叫做实例化 3.构造函数需要将其实例化后才会启用 var vm = ...

  5. Python IDE软件PyCharm通用激活方法

    1,打开软件点击help-Register 2,输入地址http://xidea.online激活

  6. Oracle Schema Objects(Schema Object Storage And Type)

    One characteristic of an RDBMS is the independence of physical data storage from logical data struct ...

  7. rabbitmq延迟队列相关

    https://blog.csdn.net/qq_26656329/article/details/77891793        --------------rabbitmq queue_decla ...

  8. 解决:“Workbench has not been created yet” error in eclipse plugin programming”,OSGI启动控制台报错问题

    项目中使用了OSGI的框架,最近被问到OSGI框架是什么,自己表示几乎没什么认识,于是想自己手动搭建一个OSGI小例子试一试 于是在搭建过程中遇到了下面的问题:项目启动很慢而且控制台也报了很多异常出来 ...

  9. python学习笔记(二)— 字符串(string)

    字符串是 Python 中最常用的数据类型.我们可以使用引号('或")来创建字符串. 创建字符串很简单,只要为变量分配一个值即可.例如: var1 = 'Hello World!' var2 ...

  10. MapReduce分析流量汇总

    一.MapReduce编程规范 一.MapReduce编程规范 用户编写mr程序主要分为三个部分:Mapper,Reducer,Driver 1.Mapper阶段 (1)用户自定义Mapper类 要继 ...