Python--字符串和对象

1.常见python函数
 abs()
 max()
 min()
 pow()
 round()
 fabs()
 ceil()
 floor()
 exp()

2. 字符串和字符
letter='A'
message=" good"
3.编码
1.ASCII码表
2.函数ord()和chr()
>>>ch = 'a'
>>>ord(ch)
97
>>> chr(98)
'b'
>>>ord()
65
>>>
3.转义序列

print(” hello word jack’s “) 错误
print(” hello word \”jack’s\”“) 正确

\b  退格
\t  制表符
\n  换行符
\f  换页符
\r  回车符
\\  反斜线
\'  单引号
\"  双引号
4.不换行打印

print(item , end = ” anyendingstring”)

5.函数 str
>>> s = str(3.4) # Convert afloat to string
>>> s
'3.4'
6.字符串连接操作

可以用+来对两个数字进行加法,也可以连接两个字符串

7.从控制台读取字符串
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值