python
文章平均质量分 52
python 学习
EINT
这个作者很懒,什么都没留下…
展开
-
python 语法练习二
from time import process_time_ns from unicodedata import name import logging 面向对象 类 class Student(object): def init(self,name,score,id): # c++ 中的构造函数 self.name = name self.score = score self.__id = id def get_info(self): print('name :%s score :%d'%(tz原创 2022-02-19 21:06:31 · 158 阅读 · 0 评论 -
python 语法练习一
import time time 模块相关函数 print(‘tick = %d’%time.time()) print(time.ctime()) print(time.process_time()) print(time.ctime()) 字符串拼接 name = ‘tang’ + ‘zhen’ + ‘ye’ print(‘name is %s’%name) 字符串截取 name = “my name is xxx” print(name[0:5]) 字符串 len name = ‘hello pyth原创 2022-02-19 21:06:18 · 68 阅读 · 0 评论 -
python笔记
字符编码 因为计算机只认识数字,如果要处理文本,就必须先把文本转换为数字才能处理。 最早的计算机在设计时采用8个比特作为一个字节 ascii 码只有127个字符,即a~z A~Z 和一些符号 要显示中文 python 3 版本中,字符串是以Unicode编码的,也就是说,Python 的字符传支持多种语言。 由于Python 的字符串类型是 str,在内存中以 Unicode 表示,一个字符对应若干字节。如果要在网络上传输,或者保存到自盘闪光,就需要把str 转换为以字节为单位的bytes print('A原创 2022-02-19 21:05:54 · 92 阅读 · 0 评论