perkins
perkins

Reputation: 11

I got an invalid syntax error for this code

I am writing a checker and got this error, pls i need help: here is the error im getting File "python1.py", line 14 print(f"Login Success e {email} & {password}") ^ SyntaxError: invalid syntax

import requests
import multiprocessing
from multiprocessing.dummy import Pool



lock = multiprocessing.Lock()


class output(object):
    def screen(self, email, password, case):
        if case==True:
            lock.acquire()
            print(f"Login Success e {email} & {password}")
            print(f"""
                e = {email}
                p = {password}
                """, file=open("live.txt", "a"))
            lock.release()
        elif case==False:
            lock.acquire()
            print(f"Login Failed e {email} & {password}")
            lock.release()

Upvotes: 1

Views: 359

Answers (1)

Netwave
Netwave

Reputation: 42746

You are probably using a python version lower that 3.6 fro mwhere the fstrings where released. Your solution is either update or rely in the old trusty str.format method:

class output(object):
    def screen(self, email, password, case):
        if case==True:
            lock.acquire()
            print("Login Success e {email} & {password}".format(email=email, password=password))
            print("""
                e = {email}
                p = {password}
                """.format(email=email, password=password), file=open("live.txt", "a"))
            lock.release()
        elif case==False:
            lock.acquire()
            print("Login Failed e {email} & {password}".format(email=email, password=password))
            lock.release()

Upvotes: 1

Related Questions