随笔分类 -  Python基础

上一页 1 ··· 3 4 5 6 7
摘要:class Player(object): def __init__(self, uid, name, status=0, level=1): self.uid = uid self.name = name self.stat = status self.level = level class Pl 阅读全文
posted @ 2020-12-19 19:15 ty1539 阅读(43) 评论(0) 推荐(0) 编辑
摘要:方式一:一个个的用函数实现 #_*_ encoding: utf-8 _*_ @author: ty hery 2019/1/12 import requests def getWeather(city): r = requests.get(u'http://wthrcdn.etouch.cn/we 阅读全文
posted @ 2020-12-19 19:09 ty1539 阅读(70) 评论(0) 推荐(0) 编辑
摘要:最先版本的 from telnetlib import Telnet from sys import stdin, stdout from collections import deque class TelnetClient(object): def __init__(self, addr, po 阅读全文
posted @ 2020-12-19 16:03 ty1539 阅读(109) 评论(0) 推荐(0) 编辑
摘要:set(),list(),tuple() 方法只接受一个值,这个值可以是列表或者是元组, 否则报错 TypeError: set expected at most 1 arguments, got 3 dict() 方法接受相当于默认参数,key不用引号'',用=号相连 sys.getsizeof( 阅读全文
posted @ 2020-12-11 10:22 ty1539 阅读(550) 评论(0) 推荐(0) 编辑
摘要:# _*_ encoding: utf-8 _*_ @author: ty hery 2019/2/18 string = "hello" # %s打印时结果是hello print("string01=%s" % string) # output: string=hello # %2s意思是字符串 阅读全文
posted @ 2020-11-30 17:20 ty1539 阅读(211) 评论(0) 推荐(0) 编辑
摘要:一,基本概念 Python代码由表达式和语句组成,并由Python解释器负责执行。它们的主要区别是“表达式”是一个值,它的结果一定是一个Python对象。当Python解释器计算它时结果可以是任何对象。例如42,1+2,int(‘123’),range(10)等。 表达式:赋值,是什么,产生结果,表 阅读全文
posted @ 2020-11-23 11:28 ty1539 阅读(248) 评论(0) 推荐(0) 编辑
摘要:Python strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。 注意:该方法只能删除开头或是结尾的字符,不能删除中间部分的字符。 str = "00000003210Runoob01230000000"; print str.strip( '0' ); # 去除首尾 阅读全文
posted @ 2019-07-17 13:45 ty1539 阅读(342) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7
点击右上角即可分享
微信分享提示