1 def crypt(source,key): from itertools import cycle result='' temp=cycle(key) for ch in source: result=result+chr(ord(ch)^ord(next(temp))) return result source='Jiangxi Insstitute of Busiess and Technology' key='zWrite' print('Before Encrypted:'+sou…
Python的字符串格式化有两种方式: 百分号方式.format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存.[PEP-3101] This PEP proposes a new system for built-in string formatting operations, intended as a replacement for the existing '%' string formatting operator. 1.百分号…
1.列表 # Filename: using_list.py # This is my shopping list shoplist=["apple", "mango", "carrot", "banana"] print ("I have", len(shoplist), "items to purchase.") print ("These items are:"…
发现Python连接字符串又是用的不顺手,影响速度 1.数字对字符进行拼接 s="" #定义这个字符串,方便做连接 print type(s) for i in range(10): print i type(i) s+=str(i) #转换类型在对接 print s 2.字符对字符进行拼接 string="abcdef" for i in string: print i+'jun' 直接使用字符串连接 3.列表和字符串的拼接 list1=['hello','…