r = requests.get('http://techtv.mit.edu/videos/1585-music-session-02/download.source')
for i in r.history:
print(i.url)
Run Code Online (Sandbox Code Playgroud)
我认为它应该打印出历史记录,但事实并非如此,上面的网址指向一个视频,但我无法得到它,有人帮忙吗?谢谢
我有很多需要处理的单词并且所有单词都以此结尾.,哪个选项具有最佳的时间复杂度?
word.substring(0, word.length()-1)
word.replaceAll("\\."?"")
word.replace(".", "")
或者,还有更好的方法?
我正在尝试打开一些文件,并且我知道使用UTF-8编码的文件中存在一些错误,所以我在python3中要做的是
open(fileName, 'r', errors = 'ignore')
Run Code Online (Sandbox Code Playgroud)
但是现在我需要使用python2,这样做的相应方式是什么?
以下是我更改为编解码器后的代码
with codecs.open('data/journalName1.csv', 'rU', errors="ignore") as file:
reader = csv.reader(file)
for line in reader:
print(line)
Run Code Online (Sandbox Code Playgroud)
文件在这里https://www.dropbox.com/s/9qj9v5mtd4ah8nm/journalName.csv?dl=0