#!/usr/bin/python
# -*- coding: UTF-8 -*-
from lib_001_decorator_log_funcname import decorator_log_funcname 
s1 = 'hello s1'
s2 = "hello s2"
s3 = '''
guyu
  conghua
    123
'''
@decorator_log_funcname
def _test_define():
#    print("\n_test_define")
    print(s1)
    print(s2)
    print(s3)   
@decorator_log_funcname
def _test_string_plus_string():
#    print("\n_test_string_plus_string")
    ss = s1 + " " + s2
    print(ss)
@decorator_log_funcname
def _test_string_cut():
#    print("\n_test_string_cut")
    ss = s1[0:3]
    print(ss)  
    ss = s1[2:4]
    print(ss)       
def _test_string_length():
    print("\n_test_string_length")  
    print(s1.__len__())    
    print(s3.__len__()) 
def _test_string_pos( ss, i ):
    print("\n_test_string_pos")  
    print(ss.find(i))
def _test_string_replace( ss, sub1, sub2 ):
    print("\n_test_string_replace") 
    ss.replace( sub1, sub2 )
    print(ss)
    print(s1) 
    ss = ss.replace( sub1, sub2 )
    print(ss)
    print(s1)     
def _func_string_insert( ss, pos, sub1 ):
    print("\n_func_string_insert") 
    l = list(ss)
    l.insert(pos, sub1)
    ss = ''.join(l)
    print(ss)
def _func_string_del( ss, sub1 ):
    print("\n_test_string_del") 
    ss = ss.replace( sub1, "" ) 
    print(ss)  
def _func_get_last_n_char( ss, n ):
    print("\n_func_get_last_n_char")    
    ll = ss.__len__()
    print( ss[ ll-n : ll ] )     
def _test():
    _test_define()
    _test_string_plus_string()
    _test_string_cut()
    _test_string_length()
    _test_string_pos(s1, 'llo')
    _test_string_replace(s1, 's1', 'xx')
    _func_get_last_n_char(s1, 2)
    _func_string_insert(s1, 1, 'xx')
    _func_string_del(s1,"el")
    
if __name__ == '__main__':
    _test()

最新文章

  1. 极路由2(极贰)在OpenWrt下定制自己的ss服务
  2. Python笔记-built-in函数,文件操作,lambda函数
  3. javascript 函数初探 (六)--- 闭包初探#4
  4. SQL常见错误及处理方法
  5. 014医疗项目-模块一:删除用户的功能l
  6. BFS POJ 3278 Catch That Cow
  7. Python的数据类型的一些知识
  8. 把自己的js模块兼容到AMD CMD CommonJS
  9. JAVA之旅(二十一)——泛型的概述以及使用,泛型类,泛型方法,静态泛型方法,泛型接口,泛型限定,通配符
  10. npm -S -D -g i 有什么区别
  11. 基于Redis+MySQL+MongoDB存储架构应用
  12. ubuntu Cairo图形库 环境搭建
  13. ubantu 操作
  14. rm与管道使用
  15. Simultaneous Localization and Mapping Technology Based on Project Tango
  16. 阿里云ECS提示RHSA-2017:3263: curl security update
  17. Python(一)之Python概述
  18. domContentload和onload
  19. hdu2060-2062
  20. 【Maven学习】Nexus私服代理其他第三方的Maven仓库

热门文章

  1. 记一次完整的PHP代码审计——yccms v3.4审计
  2. 如何快速把导出的csv表格数据导入到SqlServer中
  3. 关于HTML5中Video标签播放问题
  4. vue api封装 request.js
  5. script和template里可选链运算符?.报错Syntax Error: Unexpected token (64:2)
  6. [转载]pytest报AttributeError: module ‘pytest‘ has no attribute ‘main‘
  7. 树莓派lite安装桌面
  8. Mybatis-plus中通用mapper的CRUD(增、删、改、查)操作封装BaseMapper和IService(最详细)
  9. Linux——CentOS7无法ping通外网问题
  10. c++练习267题 火柴棒等式