所以我目前正在研究一些代码,到目前为止我还有
numbers=int(raw_input('Enter number of classes you are taking:))
#loop for info for each class
for x in range(numbers):
data = str(raw_input(Enter class name,teacher,credit hours))
df={'class name':data[0],'teacher':data[1],'credit hours':data[2]}
frame=frame.append(df,ignore_index=True)
我似乎无法获取数据框以打印用户输入字符串的第一个值,我做错了什么?
答案 0 :(得分:0)
frame = []
numbers=int(raw_input('Enter number of classes you are taking:'))
#loop for info for each class
for x in range(numbers):
data = str(raw_input('Enter classname,teacher,credithours:')).split(',')
# print(data) # out => [name,teacher,credit hours]
df={'class name':data[0],'teacher':data[1],'credit hours':data[2]}
frame=frame.append(df)
print(frame)