首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏Golang开发

    Python基础(10)——属性

    子类没有实现__init__方法时,默认自动调用父类的。 如定义__init__方法时,需自己手动调用父类的 __init__方法

    43230发布于 2019-05-28
  • 来自专栏python3

    Python基础10、MySQLdb

    一、MySQLdb模块         python访问mariadb|mysql依赖于第三方模块MySQLdb,在pypi上下载下来 路径:https://pypi.python.org/pypi/MySQL-python /  MySQL-python依赖于easy_install那先安装setuptools,这里省略 [root@Node3 ~]# unzip MySQL-python-1.2.5.zip [root  MySQL-python 1.2.5 to easy-install.pth file Installed /usr/local/python27/lib/python2.7/site-packages FILE     /usr/local/python27/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb ]: import MySQLdb In [7]: conn=MySQLdb.connect(host='127.0.0.1',user='root')   #创建连接使用conncet In [10

    1.2K40发布于 2020-01-15
  • 来自专栏侯哥的Python分享

    python基础-文件操作(10)

    word软件,新建一个word文件 写入个人简历信息 保存文件 关闭word软件 同样,在操作文件的整体过程与使用word编写一份简历的过程是很相似的 打开文件,或者新建立一个文件 读/写数据 关闭文件 在python position = f.tell() print("当前文件的位置%s"%position) f.close() 运行结果为: 读取的数据是Hel 当前文件的位置3 读取的数据是lo I am 当前文件的位置10 position) f.close() 运行结果为: 读取的数据是Hello I am Se7eN_HOU 当前文件的位置20 当前文件的位置5 六、文件的重命名 有些时候,需要对文件进行重命名、删除等一些操作,python

    52330发布于 2019-09-11
  • 来自专栏Python基础、进阶与实战

    Python基础-10 标准库简介

    10 标准库简介 10.1 操作系统接口 os os 模块提供了许多与操作系统交互的函数: os.getcwd() 返回当前目录 os.chdir() 改变当前工作目录 os.system() 在shell parser.add_argument('filenames', nargs='+') parser.add_argument('-l', '--lines', type=int, default=10 性能测量 一些Python用户对了解同一问题的不同方法的相对性能产生了浓厚的兴趣。Python提供了一种可以立即回答这些问题的测量工具。 例如,元组封包和拆包功能相比传统的交换参数可能更具吸引力。 自带电池 Python有“自带电池”的理念。通过其包的复杂和强大功能可以最好地看到这一点。 这些模块和软件包共同大大简化了 Python 应用程序和其他工具之间的数据交换。

    48420编辑于 2022-12-06
  • 来自专栏算法工程师的学习日志

    Python基础训练100题-10

    分享一些Python学习题目 实例046:打破循环 实例047:函数交换变量 实例048:数字比大小 实例049:lambda 实例050:随机数 实例046:打破循环 题目: 求输入数字的平方,如果平方运算后小于 程序分析: 无 def exc(a,b): return (b,a) a=0 b=10 a,b=exc(a,b) print(a,b) 实例048:数字比大小 题目: 数字比较。 import random print(random.uniform(10,20))

    41720编辑于 2022-07-27
  • 来自专栏CoXie带你学编程

    10Python基础快速进阶技巧

    1 反转字符串 下面的代码使用Python切片操作来反转字符串。 从某种意义上讲,切片简化了以下代码的编写(不考虑Python中-1的情况)。 3 交换俩个变量的值 Python使得在不使用另一个变量的情况下交换两个变量的值变得很容易。 Python中的Counter类。Python的计数器记录容器中每个元素出现的次数。Counter()返回一个字典,其中键是元素,出现次数是值。 count['b']) # of individual element# 3 print(count.most_common(1)) # most frequent element# [('d', 5)] 10

    87410发布于 2020-04-26
  • 来自专栏Linux云计算及前后端开发

    Python基础10-函数的递归

    举个栗子: 有一个列表 l=[1,[2,[3,[4,[5,[6,[7,[8,[9,[10,[11,]]]]]]]]]]] 想取出里面的数据 l=[1,[2,[3,[4,[5,[6,[7,[8,[9,[ 10,[11,]]]]]]]]]]] for item in l: if type(item) is not list: print(item) else: l=[1,[2,[3,[4,[5,[6,[7,[8,[9,[10,[11,]]]]]]]]]]] def search(l): for item in l: if type(item )) # 三元表达式实现 def max2(x,y): return x if x > y else y print(max2(1,10)) # 再举个例子 name=input('your ('sb')] print(l) ---- 字典生成式 现有两个列表 keys=['name','age','gender'] values=['zls',18,'male'] # 补充技巧 ,python

    40430编辑于 2022-09-26
  • 来自专栏Vamei实验室

    Python基础10 反过头来看看

    你可以尝试一下 >>>print help(list) (list是Python内置的一个类,对应于我们之前讲解过的列表) list是一个类 在上面以及看到,表是Python已经定义好的一个类。 下一步 希望你已经对Python有了一个基本了解。你可能跃跃欲试,要写一些程序练习一下。这会对你很有好处。 但是,Python的强大很大一部分原因在于,它提供有很多已经写好的,可以现成用的对象。 在Python的标准库里,还有大量可以用于操作系统互动,Internet开发,多线程,文本处理的对象。 而在所有的这些的这些的基础上,又有很多外部的库包,定义了更丰富的对象,比如numpy, tkinter, django等用于科学计算,GUI开发,web开发的库,定义了各种各样的对象。 谢谢你的关注, 欢迎来到Python的世界。 总结 len() dir() help() 数据结构list(列表)是一个类。 运算符是方法

    65190发布于 2018-01-18
  • 来自专栏python3

    python入门基础教程10 pytho

    分支语句的作用是在某些条件控制下有选择的执行实现一定功能语句块。if 分支语句则是当if后的条件满足时,if 下的语句块被执行,语法格式如下所示:

    59910发布于 2020-01-10
  • 来自专栏机器学习初学者精选文章

    Python基础python必会的10个知识点

    它们可以被认为是数据科学的基础Python。即使你只使用Pandas、Matplotlib和sciket learn,也需要全面了解Python基础知识。这些库假设你熟悉Python基础知识。 arg_printer(3, 4, param1=5, param2=6) 3 4 True {'param1': 5, 'param2': 6} https://towardsdatascience.com/10 count_sum(arr): count = len(arr) sum = arr.sum() return count, sum arr = np.random.randint(10 a = count_sum(arr) print(a) (8, 39) print(type(a)) <class 'tuple'> https://towardsdatascience.com/10 -examples-to-master-python-tuples-6c606ed42b96 ---- 10.Lambda表达式 Lambda表达式是函数的特殊形式。

    1.7K20发布于 2021-04-16
  • 来自专栏python3

    day10-11-python基础之字符

    1.开发工具   python开发IDE: pycharm、eclipse    # 专业版   # 不要汉化 2.运算符   结果是值     算数运算       a = 10 * 10     赋值运算 alex', "a": 19}) 9 print(v2)     b10  isalnum()  字符串中是否只包含 字母和数字  汉字 1 #! 6 v = test.isalnum() 7 print(v)        b10a  isalpha()  是否是字母,汉字 1 #!       b10b  isdecimal()<isdigit()<isnumeric()  当前输入是否是数字  判断的数字种类依次为 1 #! = range(10) 6 r2 = range(1,10) 7 r3 = range(1,10,2) 8 # 帮助创建连续的数字,通过设置步长来指定不连续 9 v = range(0, 100

    61130发布于 2020-01-16
  • 来自专栏JAVAandPython君

    10分钟带你学完Python基础

    ▼ 阅读本文需要10分钟 ▼ 写在前面的话 01 这篇文章是我总结的python基础,同时也参考了一些资料,内容不是特别全面,目的是带大家来看看Python里面非常基础的一些东西,想要更详细的了解, 无论是学哪一门语言基础仍然是最重要的,所以我们要及时的总结这些知识,忘记的时候也可以翻出来看一看(大家可以收藏这篇文章) Python基础 02 1 print打印语句 print('Hello', 在 Python 3 中,非 ASCII 标识符也是允许的了。 4 行,缩进 python最具特色的就是使用缩进来表示代码块,不需要使用大括号 {} 。 names = ['Michael', 'Bob', 'Tracy'] for name in names: print(name) # 打印数字 0 - 9 for x in range(10 语句会结束当前循环 print(n) n = n + 1 print('END') 输出结果: 1 2 3 4 5 6 7 8 9 10 END continue: n = 0 while

    68160发布于 2019-09-17
  • 来自专栏技术杂记

    Logstash 基础10

    发现这边的终端有输出 [root@h102 etc]# /opt/logstash/bin/logstash -f logstash-syslog.conf Settings: Default filter workers: 1 Logstash startup completed { "message" => "Dec 23 12:11:43 louis postfix/smtpd[31499]: connect from unknown[95.75.93.154]\

    30720编辑于 2022-02-10
  • 来自专栏技术杂记

    etcd 基础10

    先进行比较,然后根据比较结果来决定是否进行后面的操作,可以用于构建分布式锁机制(协调服务)

    33510编辑于 2022-01-20
  • 来自专栏技术杂记

    RabbitMQ基础10

    重置node [root@h102 rabbitmq]# rabbitmqctl reset Resetting node rabbit@h102 ... [root@h102 rabbitmq]# 让节点恢复到初始状态(原文是返回处女状态 ) This command resets the RabbitMQ node . Return a RabbitMQ node to its virgin state 必须先停掉RabbitMQ应用,才能成功执行,否则会报错 [root@h102 rabbitm

    35030编辑于 2022-05-04
  • 来自专栏技术杂记

    Consul 基础10

    服务是可以使用 HTTP API 进行动态修改 (HTTP API 可以用来进行动态的添加,删除,修改服务)

    28520编辑于 2021-12-01
  • 来自专栏技术杂记

    UnrealIRCd 基础10

    这里只是最基本的,使其可以运行并且能够访问的配置,详细的配置方法,放到以后再作讲解

    30410编辑于 2021-11-29
  • 来自专栏技术杂记

    fio基础10

    bs_is_seq_randIfthisoptionisset,fiowillusethenormalread,writeblocksizesettingsassequential,randominstead.AnyrandomreadorwritewillusetheWRITEblocksizesettings,andanysequentialreadorwritewillusetheREADblocksizesetting.zero_buffersIfthisoptionisgiven,fiowillinittheIObufferstoallzeroes.Thedefaultistofillthemwithrandomdata.refill_buffersIfthisoptionisgiven,fiowillrefilltheIObuffersoneverysubmit.Thedefaultistoonlyfillitatinittimeandreusethatdata.Onlymakessenseifzero_buffersisn't specified, naturally. If data verification is enabled, refill_buffers is also automatically enabled. scramble_buffers=bool If refill_buffers is too costly and the target is using data deduplication, then setting this option will slightly modify the IO buffer contents to defeat normal de-dupe attempts. This is not enough to defeat more clever block compression attempts, but it will stop naive dedupe of blocks. Default: true. buffer_compress_percentage=int If this is set, then fio will attempt to provide IO buffer content (on WRITEs) that compress to the specified level. Fio does this by providing a mix of random data and a fixed pattern. The fixed pattern is either zeroes, or the pattern specified by buffer_pattern. If the pattern option is used, it might skew the compression ratio slightly. Note that this is per block size unit, for file/disk wide compression level that matches this setting, you'llalsowanttosetrefill_buffers.buffer_compress_chunk=intSeebuffer_compress_percentage.Thissettingallowsfiotomanagehowbigtherangesofrandomdataandzeroeddatais.Withoutthisset,fiowillprovidebuffer_compress_percentageofblocksizerandomdata,followedbytheremainingzeroed.Withthissettosomechunksizesmallerthantheblocksize,fiocanalternaterandomandzeroeddatathroughouttheIObuffer.buffer_pattern=strIfset,fiowillfilltheiobufferswiththispattern.Ifnotset,thecontentsofiobuffersisdefinedbytheotheroptionsrelatedtobuffercontents.Thesettingcanbeanypatternofbytes,andcanbeprefixedwith0xforhexvalues.Itmayalsobeastring,wherethestringmustthenbewrappedwit

    63940编辑于 2022-04-24
  • 来自专栏技术杂记

    SQLite 基础10

    删除表 sqlite> .tables company department hello t2 test ui sqlite> drop table t2; sqlite> .tables company department hello test ui sqlite> 插入数据 sqlite> .schema test CREATE TABLE test ( id int primar

    29330编辑于 2021-12-01
  • 来自专栏技术杂记

    Docker 基础10

    删除数据 [root@h103 ~]# ll /var/lib/docker total 16 drwx------ 3 root root 77 Jan 19 17:37 containers drwx------ 5 root root 50 Jan 19 17:37 devicemapper drwx------ 5 root root 4096 Jan 19 17:37 graph -rw-r--r-- 1 root root 5120 Jan 19 17:37 linkgraph.db

    32720编辑于 2022-02-09
领券