目录

1、变量
2、字符串
3、布尔类型
4、整数
5、浮点数
6、日期

1、变量

1.1、变量的定义

- 类似于标签

1.2、变量的命名规则

- (强制)变量名只能包含数字、字母、下划线

- (强制)不能以数字开头

- (强制)不能使用保留字(函数名、常量名、关键字

- (建议)尽量简短而具有描述性

- (建议)驼峰原则<大驼峰-首字母大写><小驼峰-首字母小写>

- (建议)慎用小写的l和大写的O

1.3、变量的使用

- 输出:

a = 123

print(a)

>>123

- 运算:

a = 11

b = 22

print(a + b)

>>33

- 传参

a = 3.65

abs(a)

>>3

2、字符串
2.1、用单引号括起来表示字符串(单行字符串):

str = 'this is str'

print(str)

>>'this is str'

2.2、用双引号括起来表示字符串(与单引号相同):

str =''this is str''

print(str)

>>''this is str''

2.3、用三引号括起来表示字符串(多行字符串):

str = '''this

is

str'''

print(str)

>>'''this

is

str'''

3、布尔类型

bool = True

print(bool)

>>True

bool = False

print(bool)

>>False

4、整数

a = 6

print(a)

>>6

- 转整数

a = '36'

print(a)

>>'36'

b = int(a)

print(b)

>>36

5、浮点数

a = 3.33

print(a)

>>3.33

6、日期

 

 

最新文章

  1. 【转载】C#怎么判断字符是不是汉字
  2. http协议读书笔记2-连接管理
  3. 【转】如何使用Android Studio把自己的Android library分发到jCenter和Maven Central
  4. linux内核中的GPIO系统之(2):pin control subsystem
  5. Unity3D ShaderLab 车辆喷漆光照模型实战
  6. swat主流域文件(file.cio)参数详解——引自http://blog.sciencenet.cn/blog-922140-710636.html
  7. ipad itunes 恢复
  8. css position 应用(absolute和relative用法)
  9. Nginx入门讲解——初步认识了解nginx.conf配置文件以及配置多个虚拟主机
  10. python之async-timeout模块
  11. 使用Bazel构建C/C++项目
  12. Eclipse添加git插件上传项目到github
  13. Atitit.pagging &#160;翻页功能解决方案专题 与 目录大纲 v3 r44.docx
  14. ActiveMQ任意文件写入漏洞(版本在5.12.X前CVE-2016-3088)
  15. [抄]使用网页进行展示而非PPT
  16. Tomcat------如何打开配置界面
  17. EJB3 jpa 数据库表的映射关系
  18. 转:未能打开编辑器:Unmatched braces in the pattern.
  19. 83. Remove Duplicates from Sorted List + 82. Remove Duplicates from Sorted List II
  20. python urllib2 对 http 的 get,put,post,delete

热门文章

  1. leetcode 数据库练习 - 1205 每月交易I和II
  2. YY天气使用
  3. uni-app下拉刷新加载刷新数据
  4. Sherlock and His Girlfriend(信息学奥赛一本通 1623)
  5. cocos执行tolua/genbindings.py文件,错误搜集:
  6. UDF——涡量
  7. js转义问题
  8. 组合模式( Composite Pattern)
  9. [Beta阶段]测试报告
  10. 【Beta】测试报告