# 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. cocos2d-x学习笔记(斗地主代码)

    满足百度百科上的出牌规则,电脑可以随着玩家出牌. 百度网盘地址:链接: https://pan.baidu.com/s/1eRLpvJ8 提取密码: tf8w

  2. VBS下载者助以一臂之力

    当拿到shell到手,服务器是内网,你又没有条件映射,服务器又穿不上东西 是不是很郁闷,还有我们还有vbs,能执行cmd命令就有希望 一.VBS下载者: 复制代码 代码如下: Set Post = C ...

  3. 基于Verilog的简单FIFO读写实验

    一.模块框图及基本思路 fifo_ip:ISE生成的IP fifo_control:在fifo未满情况下不断写入递增的四位数,每隔1s读出一个数据驱动Led显示 fifo_top:前两个模块的组合 二 ...

  4. 自动化测试-1.selenium简介

    1. selenium一个自动化测试工具,适用于测试web系统2. selenium支持多种编程语言:python .java .c#.ruby3.selenium支持多浏览器,selenium脚本可 ...

  5. Python 实现累加计数的几种方法

    #要实现累加,关键在于数据存在哪儿,怎么使每次累加的都是同一个变量 行为像静态变量 #前两种都是数据存到类的成员变量, # 类利用__call__ class foo: def __init__(se ...

  6. hdu 6241 Color a Tree 2017 CCPC 哈理工站 L

    Bob intends to color the nodes of a tree with a pen. The tree consists of NN nodes. These nodes are ...

  7. [LeetCode&Python] Problem 504. Base 7

    Given an integer, return its base 7 string representation. Example 1: Input: 100 Output: "202&q ...

  8. Cocos2dx利用intersectsRect函数检测碰撞

    if (sp1->boundingBox().intersectsRect(sp2->boundingBox())) { pLabel->setString(“碰撞飞机爆炸”); } ...

  9. javascript将浮点数转换成整数

    Summary 临时我就想到3个方法而已.假设读者想到其它好用方法,也能够交流一下 parseInt 位运算符 Math.floor Math.ceil Description 一.parseInt ...

  10. 第3章 Java数组(上): 一维数组和二维数组

    3.数组及排序算法(2天) 3.1 数组的概述 2课时 3.2 一维数组的使用 3课时 3.3 多维数组的使用 3课时 3.4 数组中涉及到的常见算法 3课时 3.5 Arrays工具类的使用 3课时 ...