123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- '''
- @Author : liuyuqi
- @Contact : liuyuqi.gov@msn.cn
- @Time : 2019/08/11 09:47:45
- @Version : 1.0
- @License : (C)Copyright 2019
- @Desc : 字符串拼接
- '''
- url1 = "https://juejin.im/pins/topic/5abcaa67092dcb4620ca335c?page="
- tmp = 1
- def t1():
- '''
- join 字符串链接。。。垃圾!!
- '''
- print(url1.join(str(tmp)))
- print("".join([url1, str(tmp)]))
- print("ni hao ya".join("wo bu hao"))
- try:
- print("".join([url1, tmp]))
- except Exception as e:
- print(e)
- t1()
- def t2():
- '''
- , 逗号字符串链接,垃圾!!
- '''
- a1 = url1, tmp
- print(a1)
- t2()
- def t3():
- '''
- +,加号字符串链接,垃圾!!
- '''
- try:
- a2 = url1+tmp
- print(a2)
- except Exception as e:
- print(e)
- print(url1+str(tmp))
- t3()
- def t4():
- '''
- , 逗号字符串链接,垃圾!!
- '''
- res = '{0}{1}'.format(url1, tmp)
- print(res)
- t4()
|