简明Python学习笔记1.基础

0、python注释:

      单行:#

      多行:'''      '''

1、字面常量:字面上的意义

2、数字:int  和 floats 

3、字符串:''  or " " (the same) 

     多行字符串:"""  or  '''

     字符串不可变

4、格式化方法 format(name,age )

format 方法所做的事情便是将每个参数值替换至格式所在的位置

    name {0}  or { }

    age {1} or { }

5、print自动换行,若不需要

print('a', end='')  a后输出空格  print('a',end=' ')

6、转义字符

     \  \n :换行    \t:制表符   于行末:该行继续

'What\'s your name?'      如果:输出  What's your name?  

7、原始字符串

    让字符按其表面意思来使用

for  example:

 print(r'Newlines are indicated by \n')
输出:Newlines are indicated by \n        
 print('Newlines are indicated by \n')    \n换行
输出:Newlines are indicated by 

>>> 

8、变量

     标识符:字符、下划线、数字

9、数据类型

     数字(整数、浮点数)and 字符串

10、物理行:我看到的

       逻辑行:Python看到的

       一行执行一个语句

       若一行执行多个,用  隔开

       for example:

i= 5
print(i)
#the same as
i = 5;print(i);

11、显示行连接

i = 5

#the same as

i = \
5

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值