代码
import numpy as np
import pandas as pd
'''
with open("numbers.txt","w") as file_object:
a = 1
b = 11
for i in range(10):
for j in range(a,b):
file_object.write(str(j) + " ")
a += 10
b += 10
file_object.write("\n")
'''
label_1 = pd.read_csv('numbers.txt', sep=" ", header=None)
label_2 = pd.read_csv('numbers.txt', sep=" ")
label_3 = np.loadtxt('numbers.txt')
label_4 = pd.DataFrame(label_3)
shape_1 = label_1.shape
shape_2 = label_1.shape
shape_4 = label_4.shape
print("label_1: ")
print(label_1)
print(shape_1)
print("\n\nlabel_2: ")
print(label_2)
print(shape_2)
print("\n\nlabel_3: ")
print(label_3)
print("\n\nlabel_4: ")
print(label_4)
print(shape_4)
结果: