【发布时间】:2020-08-25 14:35:08
【问题描述】:
我需要帮助从 Google Colab 上的此文本文件 (https://www.gutenberg.org/files/768/768.txt) 中删除段落。我需要文本文件在“ccx074@pglaf.org”之后开始,并在“END OF THE PROJECT GUTENBERG EBOOK WUTHERING HEIGHTS”之前结束,以便获得准确的总字数。下面列出的是我到目前为止的编码。
# download and installing pyspark in colab
!pip install -q pyspark
# download Wuthering Heights, by Emily Bronte
!wget -q https://www.gutenberg.org/files/768/768.txt
import os.path
baseDir = os.path.join('data')
inputPath = os.path.join('/content/768.txt')
fileName = os.path.join(baseDir, inputPath)
with open('/content/768.txt','r') as f:
print(f.read())
【问题讨论】:
标签: python google-colaboratory