首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏侯哥的Python分享

    python基础-列表(7)

    index也是会找到第一个满足情况的后面就不会再找了 7、删除元素 del:根据下标进行删除 pop:删除最后一个元素 remove:根据元素的值进行删除 nameList = ["张三","李四","

    45020发布于 2019-09-11
  • 来自专栏Golang开发

    Python基础(7)——类

    定义类使用class关键字,class 后面紧跟着类名称,类名称通常首字母大写,类名称后面(object)代表当前的类的继承自object类。类主要包含属性和方法

    47030发布于 2019-05-28
  • 来自专栏高渡号外

    夯实Python基础7

    夯实Python基础 七、标准库 Python标准库,是Python程序员应该熟悉了解的又一个宝库。Python 标准库非常庞大,所提供的组件涉及范围十分广泛。 Interpret bytes as packed binary data codecs --- Codec registry and base classes 数据类型 datetime --- 基础 Python 3 代码 test --- Regression tests package for Python test.support --- Utilities for the Python test framework faulthandler --- Dump the Python traceback pdb --- Python的调试器 The Python Profilers timeit keyword --- 检验Python关键字 tokenize --- Tokenizer for Python source tabnanny --- 模糊缩进检测 pyclbr --- Python

    80530发布于 2020-09-22
  • 来自专栏Python基础、进阶与实战

    Python基础-7 输入与输出

    7. 输入与输出 7.1 更复杂的输出格式 print()函数可以输出字符串到屏幕。 对于输出的字符串,我们很多方法控制字符串的格式,如果你的python版本>=3.6,那么强烈推荐f字符串(f-string)。 f-字符串(f-string) 基础使用: f'something{var}' 在普通字符串开头加上f,然后字符串内部 可以用{var}标记,{var}会被替换成变量的值。 'Dcab': 7678} for name, phone in table.items(): print(f'{name:10} ==> {phone:10}') 详细的格式控制符在文档-Python 标准库-文本处理服务-string中:string --- 常见的字符串操作 — Python 3.10.4 文档 文章最后的附录摘取了部分说明。

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

    Python基础训练100题-7

    分享一些Python学习题目 实例031:字母识词 实例032:反向输出II 实例033:列表转字符串 实例034:调用函数 实例035:设置输出颜色 实例031:字母识词 题目: 请输入星期几的第一个字母来判断一下是星期几

    31630编辑于 2022-07-27
  • 来自专栏全栈程序员必看

    python基础7)内置函数divmod用法

    前言 我们都知道,python中//代表整数运算中的取整,%代表整数运算中的取余,那么有什么函数可以同时取到整数和余数吗? 答案是有的,使用python内置函数divmod divmod 首先看一下源码解析 def divmod(x, y): # known case of builtins.divmod """

    47320编辑于 2022-09-19
  • 来自专栏小海怪python学习

    python 基础知识第7讲:序列-列表

    1.序列 序列:是Python中最基本的一种数据结构。 数据结构指的就是计算机中数据的存储方式。 序列当中的元素可以改变 列表(list) 2.2不可变序列 序列当中的元素不可以改变 字符串(str) 元组(tuple) 3.对象 对象(object) 就是内存当中用来存储数据的一块区域 4.列表 列表也是Python 列表当中存储的数据,我们称之为元素 lst = [] # 创建了一个空的列表 lst = [1,2,3,4,5] # 创建了一个带数据的列表,多个数据之间用逗号隔开 # 列表可以保存任意对象 lst = [1,'python 美国队长'] print(hero.index('蜘蛛侠')) # 返回指定元素的索引位置 priint(len(hero)) #返回此列表的长度 print(hero.index('蜘蛛侠',2,7) 返回的结果是删除的元素对应的索引值,删除索引为2的元素 print(result) 6.remove()方法,删除指定的元素 如果相同值的元素有多个,只会删除第一个 hero.remove('绿巨人') 7.

    74720发布于 2019-08-23
  • 来自专栏AI 算法笔记

    Python基础入门7--编写测试用例

    图来自 Unsplash,作者:Brandon Hoogenboom 2019 年第 62 篇文章,总第 86 篇文章 本文大约 5000 字, 阅读大约需要 15 分钟 Python 基础入门前六篇: Python 基础入门--简介和环境配置 Python基础入门_2基础语法和变量类型 Python基础入门_3条件语句和迭代循环 Python基础入门_4函数 Python基础入门_5面向对象基础 Python 基础入门6_文件和异常 这是第七篇,也是这个基础入门系列的最后一篇内容,简单介绍如何采用 unittest模型编写测试用例。 ---- 参考 《Python编程--从入门到实践》 ---- 小结 Python基础入门系列就介绍到这里,最初第一篇初步制定的计划是如下所示: 简介和环境配置 变量和简单的数据类型 列表和元组 字典 https://github.com/ccc013/Python_Notes/blob/master/Practise/unitest_class_example.py

    69920发布于 2019-08-16
  • 来自专栏技术杂记

    Logstash 基础7

    logstash的配置中加入了 stdout {codec=>rubydebug} 是为了方便在终端监视信息(在实际应用中完全没有必要),经过一番刷屏,最终停了下来

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

    SQLite 基础7

    也可以定向的只dump一个表,但这个操作没法在shell中完成,只能在sqlite中完成

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

    UnrealIRCd 基础7

    drwx------ 2 root root 61 Mar 21 22:57 doc drwx------ 2 root root 6 Mar 21 22:57 logs drwx------ 7

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

    qshell基础7

    完全删除某空间下的文件 [root@h101 copy]# ../qshell_linux_amd64 listbucket qiniucloud-goods list.video [root@h101 copy]# ../qshell_linux_amd64 batchdelete qiniucloud-goods list.video <DANGER> Input hdbiha to confirm operation: hdbiha All deleted! [root@h101

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

    Docker 基础7

    为了避免只能使用sudo来调用Docker,在软件安装过程中自动创建了docker组,并且在docker进程启动时赋权给了这个组的用户以docker socket的读写权限,所以只用将管理用户加入到docker组,就可以对docker进行使用了

    30410编辑于 2022-02-09
  • 来自专栏技术杂记

    KVM基础7

    # systemctl get-default graphical.target [root@docker ~]# runlevel N 5 [root@docker ~]# Tip: Centos7

    46710编辑于 2022-01-19
  • 来自专栏技术杂记

    nginx基础7

    安装 [root@h102 nginx-1.9.5]# make install make -f objs/Makefile install make[1]: Entering directory `/usr/local/src/nginx-1.9.5' test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx' test -d '/usr/local/nginx/sbin' || mkdir -p '/usr/local/nginx/sbin'

    22110编辑于 2022-05-12
  • 来自专栏技术杂记

    Mycat 基础7

    这是由于没指定数据源产生的报错 虽然没有连接任何数据库,但从操作体验上来看,与直接操作一个mysql没有什么区别 Tip: 为什么用户名和密码是 test 呢,因为 conf/server.xml 有定义 <user name="test"> <property name="password">test</property> <property name="schemas">TESTDB</property> </user> <user name="user"> <property name="pas

    42220编辑于 2021-12-03
  • 来自专栏技术杂记

    memcached基础7

    root@h101 memcached-1.4.24# ps fuax | grep mem

    25110编辑于 2022-06-26
  • 来自专栏技术杂记

    etcd 基础7

    127.0.0.1:2379 > Accept: */* > < HTTP/1.1 200 OK < Content-Type: application/json < X-Etcd-Cluster-Id: 7e27652122e8b2ae

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

    fio基础7

    ; -- end job file -- Here we have no global section, as we only have one job defined anyway. We want to use async io here, with a depth of4foreach file. We also increased the buffer size used to32KB and define numjobs to4to fork 4 identical jobs. The result is4 processes each randomly writing to their own 64MB file. Instead ofusing the above job file, you could have given the parameters on the command line. For this case, you would specify: $ fio --name=random-writers --ioengine=libaio --iodepth=4 --rw=randwrite --bs=32k --direct=0 --size=64m --numjobs=4When fio is utilized as a basis ofany reasonably large test suite, it might be desirable toshare a setof standardized settings across multiple job files. Instead of copy/pasting such settings, anysection may pull in an external .fio file with'includefilename' directive, asin the following example: ;-- start job file including.fio -- [global] filename=/tmp/test filesize=1m include glob-include.fio [test] rw=randread bs=4k time_based=1 runtime=10 include test-include.fio ; -- end job file including.fio -- ; -- start job file glob-include.fio -- thread=1 group_reporting=1 ; -- end job file glob-include.fio -- ; -- start job file test-include.fio -- ioengine=libaio iodepth=4 ; -- end job file test-include.fio -- Settings pulled into a section apply to that section only (except global section). Include directives may be nested in that any included file may contain further include directive(s). Include files may not contain [] sections. 4.1 Environment variables ------------------------- fio also supports environment variable expansion in job files. Any sub-string of the form "${VARNAME}" as part of an option value (in other words, on the right of the `='),willbeexpandedtothevalueoftheenvironmentvariablecalledVARNAME.Ifnosuchenvironmentvariableisdefined,orVARNAMEistheemptystring,theemptystringwillbesubstituted.Asanexample,let's look at a sample fio invocation and job file: $ SIZE=64m NUMJOBS=4 fio jobfile.fio ; -- start job file -- [random-writers] rw=randwr

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

    RabbitMQ基础7

    注意到 {listeners,[{clustering,25672,”::”},{amqp,5672,”::”}]} 变成了 {listeners,[]} , 内存磁盘还有文件句柄部分也消失了

    22720编辑于 2022-05-04
领券