这是将URL转换为C#字符串中的超链接的最简单方法的Python端口?:
import remyString = "This is my tweet check it out http://tinyurl.com/blah"r = re.compile(r"(http://[^ ]+)")print r.sub(r'<a href="1">1</a>', myString)
输出:
This is my tweet check it out <a href="http://tinyurl.com/blah">http://tinyurl.com/blah</a>



