- 全局替换字符串
%s#old string#new string#g
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
多进程示例 | |
""" | |
import time | |
from multiprocessing import Pool | |
def run(fn): | |
time.sleep(1) | |
print(fn) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from difflib import SequenceMatcher | |
def similar(a, b): | |
return SequenceMatcher(None, a, b).ratio() | |
""" | |
>>> similar("Apple","Appel") | |
0.8 | |
>>> similar("Apple","Mango") | |
0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import random | |
# python 3.6.1以下 | |
text = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(15)) | |
print(text) | |
# python 3.6.1 | |
text = ''.join(random.choices(string.ascii_letters + string.digits, k=15)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Net; | |
using System.IO; | |
namespace ConsoleApp1 | |
{ |
NewerOlder