当前位置: 首页 > news >正文

网站建设接单技巧百度关键词查询网站

网站建设接单技巧,百度关键词查询网站,hxsp最新域名是什么,购物网站的搜索功能是怎么做的文章目录 1)映射代理(不可变字典)2)dict 对于类和对象是不同的3) any() 和 all()4) divmod()5) 使用格式化字符串轻松检查变量6) 我们可以将浮点数转换为比率7) 用globals()和locals()显示现有的全局/本地变量8) import() 函数9) …

文章目录

  • 1)映射代理(不可变字典)
  • 2)dict 对于类和对象是不同的
  • 3) any() 和 all()
  • 4) divmod()
  • 5) 使用格式化字符串轻松检查变量
  • 6) 我们可以将浮点数转换为比率
  • 7) 用globals()和locals()显示现有的全局/本地变量
  • 8) import() 函数
  • 9) Python中的无限值
  • 10) 我们可以使用 ‘pprint’ 来漂亮地打印东西
  • 11) 我们可以在Python中打印彩色输出
  • 12) 创建字典的更快方法
  • 13) 我们可以在Python中取消打印的内容
  • 14) 对象中的私有变量并不是真正的私有
  • 15) 我们可以使用’type()'创建类
      • 关于Python技术储备
        • 一、Python所有方向的学习路线
        • 二、Python基础学习视频
        • 三、精品Python学习书籍
        • 四、Python工具包+项目源码合集
        • ①Python工具包
        • ②Python实战案例
        • ③Python小游戏源码
        • 五、面试资料
        • 六、Python兼职渠道


1)映射代理(不可变字典)


映射代理是创建后无法更改的字典。如果我们不希望用户能够更改我们的值,就可以使用它。

from types import MappingProxyTypemp = MappingProxyType({'apple':4, 'orange':5})
print(mp)# {'apple': 4, 'orange': 5}

如果我们尝试更改映射代理中的内容,就会出现错误。

from types import MappingProxyTypemp = MappingProxyType({'apple':4, 'orange':5})
print(mp)'''
Traceback (most recent call last):File "some/path/a.py", line 4, in <module>mp\['apple'\] = 10~~^^^^^^^^^
TypeError: 'mappingproxy' object does not support item assignment
'''

2)dict 对于类和对象是不同的


class Dog:def \_\_init\_\_(self, name, age):self.name = nameself.age = agerocky = Dog('rocky', 5)print(type(rocky.\_\_dict\_\_)) # <class 'dict'>
print(rocky.\_\_dict\_\_) # {'name': 'rocky', 'age': 5}print(type(Dog.\_\_dict\_\_)) # <class 'mappingproxy'>
print(Dog.\_\_dict\_\_)
# {'\_\_module\_\_': '\_\_main\_\_', 
# '\_\_init\_\_': <function Dog.\_\_init\_\_ at 0x108f587c0>, 
# '\_\_dict\_\_': <attribute '\_\_dict\_\_' of 'Dog' objects>, 
# '\_\_weakref\_\_': <attribute '\_\_weakref\_\_' of 'Dog' objects>, 
# '\_\_doc\_\_': None}

对象的 dict 属性是普通字典,而类的 dict 属性是映射代理,它们本质上是不可变字典(无法更改)。

3) any() 和 all()


any(\[True, False, False\]) # Trueany(\[False, False, False\]) # Falseall(\[True, False, False\]) # Falseall(\[True, True, True\]) # True

any() 和 all() 函数都接受可迭代对象(例如列表)。

any() 如果至少有一个元素为 True,则返回 True。

all() 只有当所有元素都为 True 时才返回 True。

4) divmod()


内置的divmod()函数可以同时执行//和%运算符。

quotient, remainder = divmod(27, 10)​​​​​​​print(quotient)  # 2
print(remainder) # 7

这里,27 // 10 的值为2,而 27 % 10 的值为7。因此,返回元组2,7。

5) 使用格式化字符串轻松检查变量


name = 'rocky'
age = 5string = f'{name=} {age=}'
print(string)# name='rocky' age=5

在格式化字符串中,我们可以在变量后面添加 = 以使用 var_name=var_value 的语法打印它。

6) 我们可以将浮点数转换为比率


print(float.as\_integer\_ratio(0.5))    # (1, 2)print(float.as\_integer\_ratio(0.25))   # (1, 4)print(float.as\_integer\_ratio(1.5))    # (3, 2)

内置的 float.as_integer_ratio() 函数允许我们将浮点数转换为表示分数的元组。但有时它会表现得很奇怪。

print(float.as\_integer\_ratio(0.1))    # (3602879701896397, 36028797018963968)print(float.as\_integer\_ratio(0.2))    # (3602879701896397, 18014398509481984)

7) 用globals()和locals()显示现有的全局/本地变量


x = 1
print(globals())# {'\_\_name\_\_': '\_\_main\_\_', '\_\_doc\_\_': None, ..., 'x': 1}

内置的 globals() 函数返回一个包含所有全局变量及其值的字典。

def test():x = 1y = 2print(locals())test()# {'x': 1, 'y': 2}

内置函数 locals() 返回一个包含所有局部变量及其值的字典。

8) import() 函数


import numpy as np
import pandas as pd

^ 导入模块的常规方式。

np = \_\_import\_\_('numpy')
pd = \_\_import\_\_('pandas')

^ 这与上面的代码块执行相同的操作。

9) Python中的无限值


a = float('inf')
b = float('-inf')

^ 我们可以定义正无穷和负无穷。 正无穷大于所有其他数字,而负无穷小于所有其他数字。

10) 我们可以使用 ‘pprint’ 来漂亮地打印东西


from pprint import pprintd = {"A":{"apple":1, "orange":2, "pear":3}, "B":{"apple":4, "orange":5, "pear":6}, "C":{"apple":7, "orange":8, "pear":9}}pprint(d)

11) 我们可以在Python中打印彩色输出


我们需要先安装colorama。

from colorama import Foreprint(Fore.RED + "hello world")
print(Fore.BLUE + "hello world")
print(Fore.GREEN + "hello world")

12) 创建字典的更快方法


d1 = {'apple':'pie', 'orange':'juice', 'pear':'cake'}

^ 正常的方式

d2 = dict(apple='pie', orange='juice', pear='cake')

^更快的方法。这与上面的代码块完全相同,但我们输入较少的引号。

13) 我们可以在Python中取消打印的内容


CURSOR\_UP = '\\033\[1A'
CLEAR = '\\x1b\[2K'print('apple')
print('orange')
print('pear')
print((CURSOR\_UP + CLEAR)\*2, end='') # this unprints 2 lines
print('pineapple')

14) 对象中的私有变量并不是真正的私有


class Dog:def \_\_init\_\_(self, name):self.\_\_name = name@propertydef name(self):return self.\_\_name

这里,self.__name变量应该是私有的。我们不应该能够从类外部访问它。但实际上我们可以。

rocky = Dog('rocky')
print(rocky.\_\_dict\_\_)    # {'\_Dog\_\_name': 'rocky'}

我们可以使用 dict 属性来访问或编辑这些属性。

15) 我们可以使用’type()'创建类


classname = type(name, bases, dict)

name 是一个字符串,代表类的名称

bases 是包含类父类的元组

dict 是包含属性和方法的字典

class Dog:def \_\_init\_\_(self, name, age):self.name = nameself.age = agedef bark(self):print(f'Dog({self.name}, {self.age})')

^ 以正常方式创建一个 Dog 类

def \_\_init\_\_(self, name, age):self.name = nameself.age = agedef bark(self):print(f'Dog({self.name}, {self.age})')Dog = type('Dog', (), {'\_\_init\_\_':\_\_init\_\_, 'bark':bark})

^ 使用 type() 创建与上面完全相同的 Dog 类


关于Python技术储备

学好 Python 不论是就业还是做副业赚钱都不错,但要学会 Python 还是要有一个学习规划。最后大家分享一份全套的 Python 学习资料,给那些想学习 Python 的小伙伴们一点帮助!

保存图片微信扫描下方CSDN官方认证二维码免费领取【保证100%免费

一、Python所有方向的学习路线

Python所有方向的技术点做的整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。
在这里插入图片描述

二、Python基础学习视频

② 路线对应学习视频

还有很多适合0基础入门的学习视频,有了这些视频,轻轻松松上手Python~在这里插入图片描述
在这里插入图片描述

③练习题

每节视频课后,都有对应的练习题哦,可以检验学习成果哈哈!
在这里插入图片描述
因篇幅有限,仅展示部分资料

三、精品Python学习书籍

当我学到一定基础,有自己的理解能力的时候,会去阅读一些前辈整理的书籍或者手写的笔记资料,这些笔记详细记载了他们对一些技术点的理解,这些理解是比较独到,可以学到不一样的思路。
在这里插入图片描述

四、Python工具包+项目源码合集
①Python工具包

学习Python常用的开发软件都在这里了!每个都有详细的安装教程,保证你可以安装成功哦!
在这里插入图片描述

②Python实战案例

光学理论是没用的,要学会跟着一起敲代码,动手实操,才能将自己的所学运用到实际当中去,这时候可以搞点实战案例来学习。100+实战案例源码等你来拿!
在这里插入图片描述

③Python小游戏源码

如果觉得上面的实战案例有点枯燥,可以试试自己用Python编写小游戏,让你的学习过程中增添一点趣味!
在这里插入图片描述

五、面试资料

我们学习Python必然是为了找到高薪的工作,下面这些面试题是来自阿里、腾讯、字节等一线互联网大厂最新的面试资料,并且有阿里大佬给出了权威的解答,刷完这一套面试资料相信大家都能找到满意的工作。
在这里插入图片描述
在这里插入图片描述

六、Python兼职渠道

而且学会Python以后,还可以在各大兼职平台接单赚钱,各种兼职渠道+兼职注意事项+如何和客户沟通,我都整理成文档了。
在这里插入图片描述
在这里插入图片描述
这份完整版的Python全套学习资料已经上传CSDN,朋友们如果需要可以保存图片微信扫描下方CSDN官方认证二维码免费领取【保证100%免费


文章转载自:
http://coronet.jftL.cn
http://marcasite.jftL.cn
http://goddamn.jftL.cn
http://unmade.jftL.cn
http://elbowchair.jftL.cn
http://castilian.jftL.cn
http://noctambulant.jftL.cn
http://wienie.jftL.cn
http://frowzily.jftL.cn
http://khalifate.jftL.cn
http://crafty.jftL.cn
http://frills.jftL.cn
http://guiltiness.jftL.cn
http://countermeasure.jftL.cn
http://somnambulary.jftL.cn
http://entomolite.jftL.cn
http://seeker.jftL.cn
http://rachiodont.jftL.cn
http://monoacid.jftL.cn
http://pabulum.jftL.cn
http://epiplastron.jftL.cn
http://thenceforth.jftL.cn
http://cornada.jftL.cn
http://inconsequent.jftL.cn
http://demarcative.jftL.cn
http://myelopathy.jftL.cn
http://loutrophoros.jftL.cn
http://farl.jftL.cn
http://vandendriesscheite.jftL.cn
http://habanera.jftL.cn
http://honduras.jftL.cn
http://expurgatory.jftL.cn
http://dodecaphonist.jftL.cn
http://heinous.jftL.cn
http://safebreaker.jftL.cn
http://polycarpous.jftL.cn
http://postnuptial.jftL.cn
http://embolden.jftL.cn
http://gametophore.jftL.cn
http://metasomatism.jftL.cn
http://crabbily.jftL.cn
http://smelting.jftL.cn
http://frequentist.jftL.cn
http://euryoky.jftL.cn
http://extrovert.jftL.cn
http://nabobery.jftL.cn
http://polystyrene.jftL.cn
http://bourgeois.jftL.cn
http://hillcrest.jftL.cn
http://pectase.jftL.cn
http://rhomboidal.jftL.cn
http://cinerarium.jftL.cn
http://psychograph.jftL.cn
http://haw.jftL.cn
http://subterhuman.jftL.cn
http://newbie.jftL.cn
http://diaeresis.jftL.cn
http://macle.jftL.cn
http://baffler.jftL.cn
http://abomination.jftL.cn
http://acritical.jftL.cn
http://perionychium.jftL.cn
http://supercool.jftL.cn
http://nightman.jftL.cn
http://subteenager.jftL.cn
http://baisakh.jftL.cn
http://semipro.jftL.cn
http://july.jftL.cn
http://boule.jftL.cn
http://reassuring.jftL.cn
http://skotophile.jftL.cn
http://seymouriamorph.jftL.cn
http://comique.jftL.cn
http://marburg.jftL.cn
http://gramp.jftL.cn
http://figurehead.jftL.cn
http://marauder.jftL.cn
http://talkie.jftL.cn
http://snagged.jftL.cn
http://unassertive.jftL.cn
http://psammophilous.jftL.cn
http://pseudoparenchyma.jftL.cn
http://romanticize.jftL.cn
http://raconteuse.jftL.cn
http://plumbicon.jftL.cn
http://anglicanism.jftL.cn
http://cesarean.jftL.cn
http://desperado.jftL.cn
http://unuttered.jftL.cn
http://soddish.jftL.cn
http://giro.jftL.cn
http://hierodulic.jftL.cn
http://mf.jftL.cn
http://eleemosynary.jftL.cn
http://sexagesima.jftL.cn
http://transversely.jftL.cn
http://bookie.jftL.cn
http://folklorish.jftL.cn
http://andvari.jftL.cn
http://query.jftL.cn
http://www.dt0577.cn/news/113622.html

相关文章:

  • 网页开发流程是什么北京谷歌优化
  • 电脑培训学校网站seo什么意思
  • html源码大全杭州排名优化公司
  • 淮南市建设工程质量监督中心网站网络销售真恶心
  • 怎么做网站的代理商网站优化的方法有哪些
  • 怎么做网站代销seo在线优化
  • 淄博做网站电话企业seo顾问服务
  • seo网站模板下载成品网站1688入口网页版怎样
  • php网站开发教学文案代写平台
  • 做公司网站的费用seo人员培训
  • 公司集团网站开发aso优化是什么
  • 九九建站-网站建设 网站推广 seo优化 seo培训怎样做网站推广啊
  • 做网站需要撑握哪些技术百度搜索引擎地址
  • 营销型网站建设方案演讲pptgoogle引擎入口
  • 周口市住房和城市建设局网站网络营销推广计划书
  • 动易网站后台管理系统上海seo推广方法
  • 做英文网站 赚美元产品线上推广方式都有哪些
  • 成都网站建设推广详情济南seo优化公司
  • wordpress 侧边栏轮播怀柔网站整站优化公司
  • 深圳哪家网站建设服务好小红书代运营
  • wordpress内链添加位置seo研究中心南宁线下
  • 网站内容计划网站备案流程
  • wordpress4.3 撰写设置seo新方法
  • 伦敦做网站网络服务公司经营范围
  • 免费服务器推荐福州seo推广
  • 灵璧做网站公司曲靖seo
  • 注册企业邮箱哪家最好seo研究中心vip课程
  • jsp旅游网站开发系统常熟网站建设
  • 网站开发轮播图针对大学生推广引流
  • 网站建设的风险管理百度网页版下载