[英]Trouble with importing simple .txt file to Python
I am unable to get Python to read a simple table shown in the image我无法让 Python 读取图像中显示的简单表格
Below is the code I am using, and I have the code file saved in the same folder as the 'simple_table.txt' file so it should open without calling the full path to the file which I have also tried and still does not work.下面是我正在使用的代码,我将代码文件保存在与“simple_table.txt”文件相同的文件夹中,因此它应该打开而不调用文件的完整路径,我也尝试过但仍然无法正常工作。 When I run the code, I get a 'finished with exit code 0', so my code does not seem to have any errors.
当我运行代码时,我得到一个'finished with exit code 0',所以我的代码似乎没有任何错误。 Anything that I am missing.
我缺少的任何东西。 Code Shown Below.
代码如下所示。
import pandas as pd
number_list = pd.read_table('simple_table.txt')
print(number_list.shape)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 29 11:38:07 2020
@author: bob
"""
import pandas as pd
number_list = pd.read_table('simple_table.txt')
print('printing : ',number_list.shape)
run it:运行:
printing : (9, 1)
no error没有错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.