首页 > 编程语言 > 详细

2019-04-18 Python Base 1

时间:2019-04-18 11:03:02      阅读:496      评论:0      收藏:0      [点我收藏+]
C:\Users\Jeffery1u>python
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated.  Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.
>>> 23+7
30
>>> 4**2
16
>>> result=20
>>> print(result)
20
>>> x=30
>>> x+=70
>>> x
100
>>> int(4.3)
4
>>> float(10)
10.0
>>> round(4.67)
5
>>> # i love u
... x=30
>>> x
30
>>> type(x)
<class ‘int‘>
>>> str=‘i love u‘
>>> str
‘i love u‘
>>> # 使用双引号开始字符串,单引号开始内部字符串
... str="i love ‘u‘"
>>> str
"i love ‘u‘"
>>> print(str)
i love ‘u‘
>>> str=‘‘‘i‘m love "u" ‘‘‘
>>> print(str)
i‘m love "u"
>>> #上面也可以使用三引号
... #使用加号字符串
... pring("a"+"b")
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
NameError: name ‘pring‘ is not defined
>>> print("a"+"b")
ab
>>> "a"+"b" 

  

2019-04-18 Python Base 1

原文:https://www.cnblogs.com/theDataDigger/p/10728211.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!