2020-09-09

Python学习

对象及引用丶标识符丶变量和简单的赋值等基础知识

通过使用对象了解了a=3不是简单的把3赋值给a

下面是Demo

>>> a=3
>>> a
3
>>> id(3)
140712168882512
>>> type(3)
<class 'int'>
>>> b='我爱你'
>>> id(a)
SyntaxError: invalid character in identifier
>>> id(a)
140712168882512
>>> type(a)
<class 'int'>
>>> print(a)
3
>>> id(b)
2264076995632
>>> type(b)
<class 'str'>
>>> 
>> 通过使用引用了解了python是动态类型语言和强类型语言


```python
>> 通过使用标识符了解基本用法
>1.给变量起名字区分大小写
>2.以字母和下划线开头,其后的字符是:字母,数字,下划线
>3.不能使用关键字。
>4.双下划线开头和结尾的名称都有特殊的含义,尽量 避免这种写法
>模块和报名规则:全小写字母,尽量简单,若多个单词之间用下划线
>函数名:全小写字母,多个单词之间用下划线隔开
>类名:首字母大写,采用驼峰原则,多个单词时,每个单词第一个字母大写,其余部分小写,常量名:全大写字母,多个单词用下划线隔开
>下面是Demo
><class 'str'>
>>> sxt=123
>>>  sxt=234
 
SyntaxError: unexpected indent
>>> 3sdf=33
SyntaxError: invalid syntax
>>> help()

Welcome to Python 3.7's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".

help> keywords

Here is a list of the Python keywords.  Enter any keyword to get more help.

False               class               from                or
None                continue            global              pass
True                def                 if                  raise
and                 del                 import              return
as                  elif                in                  try
assert              else                is                  while
async               except              lambda              with
await               finally             nonlocal            yield
break               for                 not                 

help> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值