def regEx1(): os.chdir("C:/Users/Luke/Desktop/myFiles") papers = os.listdir(".") os.mkdir("C:/Users/Luke/Desktop/FilesWithRegEx") regex_txt = input("Please go into the website your are looking for:") because that x in (files): inputFile = open((x), encoding = "utf8", "r") content = inputFile.read() inputFile.close() regex = re.compile(regex_txt, re.IGNORECASE) if re.search(regex, content)is no None: shutil.copy(x, "C:/Users/Luke/Desktop/FilesWithRegEx")I obtain the adhering to error post which points come the an initial line ~ the because that loop.
You are watching: Syntaxerror non keyword arg after keyword arg
^SyntaxError: non-keyword arg ~ keyword argWhat is bring about this error?
It"s just what it says:
inputFile = open((x), encoding = "utf8", "r")You have specified encoding as a keyword argument, however "r" as a positional argument. Friend can"t have actually positional arguments after keyword arguments. Perhaps you wanted to do:
inputFile = open((x), "r", encoding = "utf8")
To really obtain this clear, here"s my for-beginners answer:You inputed the debates in the wrong order.A keyword argument has this style:
nullable=True, unique=FalseA fixed parameter need to be defined: True, False, etc.A non-keyword debate is different:
name="Ricardo", fruit="chontaduro" This syntax error asks girlfriend to an initial put name="Ricardo" and every one of its type (non-keyword) before those like nullable=True.
Thanks because that contributing solution to stack Overflow!Please be sure to answer the question. Provide details and share her research!
But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; ago them up with recommendations or an individual experience.
See more: Anthem Service Is Currently Unavailable Error Fix, Connection Problem
To find out more, see our tips on writing an excellent answers.
post Your price Discard
site architecture / logo design © 2021 ridge Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.10.12.40432