# st='hello kitty {name} is {age}'
#
# print(st.count('l')) # 统计元素个数
# print(st.capitalize()) # 首字母大写
# print(st.center(50,'#')) # 居中
# print(st.endswith('tty3')) # 判断是否以某个内容结尾
# print(st.startswith('he')) # 判断是否以某个内容开头
# print(st.expandtabs(tabsize=20))
# print(st.find('t')) # 查找到第一个元素,并将索引值返回
# print(st.format(name='alex',age=37)) # 格式化输出的另一种方式 待定:?:{}
# print(st.format_map({'name':'alex','age':22}))
# print(st.index('t'))
# print('asd'.isalnum())
# print('12632178'.isdecimal())
# print('1269999.uuuu'.isnumeric())
# print('abc'.isidentifier())
# print('Abc'.islower())
# print('ABC'.isupper())
# print(' e'.isspace())
# print('My title'.istitle())
# print('My tLtle'.lower())
# print('My tLtle'.upper())
# print('My tLtle'.swapcase())
# print('My tLtle'.ljust(50,'*'))
# print('My tLtle'.rjust(50,'*'))
# print('\tMy tLtle\n'.strip())
# print('\tMy tLtle\n'.lstrip())
# print('\tMy tLtle\n'.rstrip())
# print('ok')
# print('My title title'.replace('itle','lesson',1))
# print('My title title'.rfind('t'))
# print('My title title'.split('i',1))
# print('My title title'.title()) #摘一些重要的字符串方法
#1 print(st.count('l'))
# print(st.center(50,'#')) # 居中
# print(st.startswith('he')) # 判断是否以某个内容开头
# print(st.find('t'))
# print(st.format(name='alex',age=37)) # 格式化输出的另一种方式 待定:?:{}
# print('My tLtle'.lower())
# print('My tLtle'.upper())
# print('\tMy tLtle\n'.strip())
# print('My title title'.replace('itle','lesson',1))
# print('My title title'.split('i',1))
 # a=list()
# print(a) # dic={'name':'alex'} # dic1={}
# dic2=dict((('name','alex'),))
# print(dic2) # dic3=dict([['name','alex'],])
# print(dic3)
 # ret2=dic1.setdefault('hobby','girl')
# print(dic1)
# print(ret2) # dic3={'age': 18, 'name': 'alex', 'hobby': 'girl'}
#
# print(dic3['name'])
#
# print(list(dic3.keys()))
# print(list(dic3.values()))
# print(list(dic3.items())) # li=[1,2,34,4]
# li[2]=5
# dic3={'age': 18, 'name': 'alex', 'hobby': 'girl'}
# dic3['age']=55
# print(dic3) # dic4={'age': 18, 'name': 'alex', 'hobby': 'girl'}
# # dic5={'1':'111','2':'222'}
# dic5={'1':'111','name':'222'}
#
# dic4.update(dic5)
# print(dic4)
# print(dic5)

 # dic1={'name':'alex'}
# dic1['age']=18
# print(dic1)
 # dic5 = {'name': 'alex', 'age': 18, 'class': 1}

 # dic5.clear() # 清空字典
# print(dic5)
# del dic5['name'] #删除字典中指定键值对
# print(dic5) # print(dic5.pop('age')) #删除字典中指定键值对,并返回该键值对的值
# ret=dic5.pop('age')
# print(ret)
# print(dic5) # a = dic5.popitem() #随机删除某组键值对,并以元组方式返回值
# print(a, dic5) # del dic5 #删除整个字典
# print(dic5)

06 python下的更多相关文章

  1. python下的select模块使用 以及epoll与select、poll的区别

    python下的select模块使用 以及epoll与select.poll的区别 先说epoll与select.poll的区别(总结) 整理http://www.zhihu.com/question ...

  2. python下ssh的简单实现

    python下的ssh都需要借助第三方模块paramiko来实现,在使用前需要手动安装. 一.python实现ssh (1) linux下的ssh登录 root@ubuntu:~# ssh morra ...

  3. python下编译py成pyc和pyo

     python下编译py成pyc和pyo   其实很简单, 用 python -m py_compile file.py python -m py_compile /root/src/{file1,f ...

  4. Python下划线与命名规范

    Python下划线与命名规范 先看结论,节省只想知道答案你的宝贵时间: _xxx 不能用于from module import * 以单下划线开头的表示的是protected类型的变量.即保护类型只能 ...

  5. python下的orm基本操作(1)--Mysql下的CRUD简单操作(含源码DEMO)

    最近逐渐打算将工作的环境转移到ubuntu下,突然发现对于我来说,这ubuntu对于我这种上上网,收收邮件,写写博客,写写程序的时实在是太合适了,除了刚接触的时候会不怎么完全适应命令行及各种权限管理, ...

  6. Python下科学计算包numpy和SciPy的安装

    转载自:http://blog.sina.com.cn/s/blog_62dfdc740101aoo6.html Python下大多数工具包的安装都很简单,只需要执行 “python setup.py ...

  7. python下的复杂网络编程包networkx的安装及使用

    由于py3.x与工具包的兼容问题,这里采用py2.7 1.python下的复杂网络编程包networkx的使用: http://blog.sina.com.cn/s/blog_720448d30101 ...

  8. Python学习入门基础教程(learning Python)--5.1 Python下文件处理基本过程

    Python下的文件读写操作过程和其他高级语言如C语言的操作过程基本一致,都要经历以下几个基本过程. 1. 打开文件 首先是要打开文件,打开文件的主要目的是为了建立程序和文件之间的联系.按程序访问文件 ...

  9. python下读取excel文件

    项目中要用到这个,所以记录一下. python下读取excel文件方法多种,用的是普通的xlrd插件,因为它各种版本的excel文件都可读. 首先在https://pypi.python.org/py ...

随机推荐

  1. 获取进程ID,父进程ID,进程完整路径

    准备写一个进程管理的功能模块,今天下午先写了扫描获取本机各个进程路径,获取各个进程映像名称,进程完整路径. 要获取进程信息,第一步想到的就是提权,提权代码用过多次了,今天也小结了一下(http://w ...

  2. eclipse工具类及插件(Eclipse超好用的插件推荐)

    https://blog.csdn.net/ghostxbh/article/details/80054948

  3. JavaScript 之 BOM

    BOM BOM(Bowser Object Model)   浏览器对象模型 提供了独立于页面内容而与浏览器就行交互的对象,核心对象是window. (BOM 无标准支持) Navigator 浏览器 ...

  4. noj电子老鼠走迷宫(深搜dfs)超时错误

    1042.电子老鼠闯迷宫 时限:1000ms 内存限制:10000K  总时限:3000ms 描述 有一只电子老鼠被困在如下图所示的迷宫中.这是一个12*12单元的正方形迷宫,黑色部分表示建筑物,白色 ...

  5. oracle监控资源管理器

    资源管理器的配置在一组dba视图显示,主要是如下视图: dba_rsrc_plans 显示计划和状态. dba_rsrc_plan_directives 显示计划指令 dba_rsrc_consume ...

  6. 关于测绘软件南方CASS(7.0)成图系统的使用心得

    关于测绘软件南方CASS(7.0)成图系统的使用心得   王天池 南方CASS是一款基于CAD平台开发的一套集地形地籍空间数据建库工程工程应用土石算量等功能为一体的绘图软件. 初识这款软件是在大二校园 ...

  7. git的优缺点

      git可以说是世界上最先进的版本控制系统,大多语句的执行为linux语句,也不难怪,,起初他就是为了帮助开发linux开发内核而使用. 我们先来说git的主要功能,知道了这个,我们也就知道了为什么 ...

  8. 跨源资源共享(CORS)概念、实现(用Spring)、起源介绍

    本文内容引用自: https://howtodoinjava.com/spring5/webmvc/spring-mvc-cors-configuration/ https://developer.m ...

  9. systemd service 设置limit,不生效问题

    参考博文: http://smilejay.com/2016/06/centos-7-systemd-conf-limits/(解决方法参考此博文)   问题简述:Centos7下修改系统的最大文件打 ...

  10. 使用 vue-cli-service inspect 来查看一个 Vue CLI 3 项目的 webpack 配置信息(包括:development、production)

    使用 vue-cli-service inspect 来查看一个 Vue CLI 3 项目的 webpack 配置信息(包括:development.production) --mode 指定环境模式 ...