Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在google colab中读取.docx文件?_Python_Python 3.x_Google Colaboratory_Google Docs_File Read - Fatal编程技术网

Python 如何在google colab中读取.docx文件?

Python 如何在google colab中读取.docx文件?,python,python-3.x,google-colaboratory,google-docs,file-read,Python,Python 3.x,Google Colaboratory,Google Docs,File Read,我正试图将docx文件读入google collab,因为我和anaconda在一起的主计算机已经进行了维护。我试图使用PythonDocx模块,但据我所知,我不能在GoogleCollab中安装PythonDocx ''' ''' 有什么想法吗?试试下面的方法;希望它能起作用: #Install python-docx !pip install python-docx #<-- Yes you can directly install in Colab #Import the tool

我正试图将docx文件读入google collab,因为我和anaconda在一起的主计算机已经进行了维护。我试图使用PythonDocx模块,但据我所知,我不能在GoogleCollab中安装PythonDocx

'''

'''


有什么想法吗?

试试下面的方法;希望它能起作用:

#Install python-docx
!pip install python-docx #<-- Yes you can directly install in Colab

#Import the tools
import docx
from google.colab import files

uploaded = files.upload() #<-- Select the file you want to upload
file_name = '[whatever your file is called here].docx' #<-- Change filename to your file
doc = docx.Document(file_name)
#安装python docx
!pip安装pythondocx#
#Install python-docx
!pip install python-docx #<-- Yes you can directly install in Colab

#Import the tools
import docx
from google.colab import files

uploaded = files.upload() #<-- Select the file you want to upload
file_name = '[whatever your file is called here].docx' #<-- Change filename to your file
doc = docx.Document(file_name)