Jump to content

lakshitha

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by lakshitha

  1. Try to connect again adding "port" argument like this, conn2 = mysql.connector.connect(host="localhost", user="root", passwd="12345", database="empl", port="#PORT") Otherwise, Go to localhost sever using browser and make sure about that password is correct. Or make a new account (with password or without) and try to execute your queries via command line with database.
  2. Did you put a password for root account? Otherwise don't use any password for access.
  3. passwd must be password !
  4. lakshitha

    bug

    You answered like this? print("yes") if 5 > 2 else print("no")
  5. >>> x = float(2.8) >>> type(x) <class 'float'> >>> x = 2.8 >>> type(x) <class 'float'> Both answers are correct !
  6. def sortList(myList): myList.sort() evens = [] odds = [] for i in myList: if (i % 2) == 0: evens.append(i) else: odds.append(i) print(evens + odds) numbers = [5, 7, 2, 6, 1, 3, 44, 14, 9] sortList(numbers)
  7. Use pyinstaller ! more : https://www.pyinstaller.org/
  8. You have to use web scraping modules like BeautifulSoup for do this job. import urllib2 from bs4 import BeautifulSoup url = "www.example.com" html = urllib2.urlopen(url) soup = BeautifulSoup(html) img_src = soup.find('div', {'class':'captcha-image'})['style'] #Hereafter, you can select the base64 encoded string.
  9. Exactly, You used an unexpected character after \ (backslash) in your python file. Please, can you publish your code here? If you are , I can give the best solution.
  10. Make sure what you already installed those package via Pip Find out .py files of those modules and place them in directory of your .py file Reinstall Python in your PC
  11. Hi Lara, If you want to print illegal something in Python, you should use escape character. >>> print("I am using \" illegal \" something.") I am using " illegal " something. else if you want to print two backslashes (\\) in string, you must use r before string. >>> print(r"This will insert two \\ (backslashes)") This will insert two \\ (backslashes)
×
×
  • Create New...