0
그래서 다른 코드를 입력하여 코드를 특정 열에 인쇄하려고합니다. 그래서 사람이 5 가지 다른 유형의 영화를 입력하고 엑셀 파일을 통해 openpyxl을 반복하고 5 개의 영화를 찾고 전체 줄을 인쇄하도록 코드를 만들었지 만 오류는 계속해서 튀어 나오지 않습니다. 이 내 코드입니다Openpyxl : AttributeError : '통합 문서'개체에 '셀'속성이 없습니다.
Traceback (most recent call last):
File "C:/Users/Shay/PycharmProjects/untitled/Assignment ITN.py", line 39, in <module>
listcreator(movieID)
File "C:/Users/Shay/PycharmProjects/untitled/Assignment ITN.py", line 28, in listcreator
if sheet.cell(row=r, column=c).value == movieOne:
AttributeError: 'Workbook' object has no attribute 'cell'
: 나는 또한 내가 멍청한 놈 코더입니다 그래서 미안 해요 언급해야
import csv
import openpyxl
from openpyxl import load_workbook
movieID = openpyxl.load_workbook(filename="C:/Users/Shay/Downloads/Movie IDs - Student Copy.xlsx")
movie_ID = movieID.active
movie_ID_List = []
movie_Ratings_list = []
mveavg = []
movieOne = input("Type first Movie\n")
movieTwo = input("Type in second movie\n")
movieThree = input("Type in third movie\n")
movieFour = input("Type in fourth movie\n")
movieFive = input("Type in fifth movie\n")
movieOneList = []
movieTwoList = []
movieThreeList = []
movieFourList = []
movieFiveList = []
def listcreator(sheet):
for r in range(1, 27278):
for c in range(1,2):
if sheet.cell(row=r, column=c).value == movieOne:
movieOneList.append(sheet.cell(row=r, column=0))
if sheet.cell(row=r, column=c).value == movieTwo:
movieTwoList.append(sheet.cell(row=r, column=0))
if sheet.cell(row=r, column=c).value == movieThree:
movieThreeList.append(sheet.cell(row=r, column=0))
if sheet.cell(row=r, column=c).value == movieFour:
movieFourList.append(sheet.cell(row=r, column=0))
if sheet.cell(row=r, column=c).value == movieFive:
movieFiveList.append(sheet.cell(row=r, column=0))
listcreator(movieID)
print(movieOneList)
print(movieTwoList)
print(movieThreeList)
print(movieFourList)
print(movieFiveList)
movieOneList - (movieOneList[0])
movieTwoList - (movieTwoList[0])
movieThreeList - (movieThreeList[0])
movieFourList - (movieFourList[0])
movieFiveList - (movieFiveList[0])
print(movieOneList)
print(movieTwoList)
print(movieThreeList)
print(movieFourList)
print(movieFiveList)
이 질문은 정말 보이는 경우가
출력이
해결하는 방법을 알고 기본이지만 도움을 좋아할 것입니다