Chinaunix首页 | 论坛 | 博客
  • 博客访问: 951064
  • 博文数量: 83
  • 博客积分: 32
  • 博客等级: 民兵
  • 技术积分: 2080
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-12 09:45
个人简介

努力学习,努力分享,努力.....在努力..努力离开..

文章分类

全部博文(83)

文章存档

2017年(3)

2015年(1)

2014年(47)

2013年(32)

分类: Python/Ruby

2017-04-19 18:02:43

最近需要学Python写代码了,打算写个简易的学习笔记...^_^

学习任何语言自然要从Hello World开始啦

root:~ root$ Python
Python 2.7.10 (default, Feb  6 2017, 23:53:20)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> print "hello world"
hello world
>>> exit()

root:~ root$ python hello.py
hello world
roots:~ root$ cat hello.py
#!/usr/bin/python

print 'hello world'

接着看数据类型:
>>> a = 10
>>>
>>> print (a)
10
>>> print (type(a))


>>> a = 5.4
>>>
>>> print (a,type(a))
(5.4, )
>>>

>>> a = 10
>>> a = False
>>> a = 3.2
>>> a = 'Hello World'

type查看数据类型,其它就是整数、字符串、浮点数等等啦


阅读(1726) | 评论(0) | 转发(0) |
0

上一篇: Redis Cluster 介绍与使用

下一篇:没有了

给主人留下些什么吧!~~