Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pulling username from Tuple
#3
[/quote]

Untested, but...
With that for loop, it seems to me that userName is the object to test: if userName == 'support':
[/quote]

Didnt work with this

sql_GetUser = "select user, host from mysql.user;"
    cursor.execute(sql_GetUser)
    logger.info("Got a list of users")
    users= cursor.fetchall ()
    print("User List:")
    for userName in users:
        if userName == 'support':
            print('name is there')
        else:
            print('user isnt here')
Result was

User List:
user isnt here
user isnt here
user isnt here
user isnt here
user isnt here
user isnt here
user isnt here
user isnt here
user isnt here
user isnt here
user isnt here
Reply


Messages In This Thread
Pulling username from Tuple - by pajd - Oct-06-2022, 01:57 PM
RE: Pulling username from Tuple - by rob101 - Oct-06-2022, 02:06 PM
RE: Pulling username from Tuple - by pajd - Oct-06-2022, 02:13 PM
RE: Pulling username from Tuple - by rob101 - Oct-06-2022, 02:16 PM
RE: Pulling username from Tuple - by deanhystad - Oct-06-2022, 02:23 PM
RE: Pulling username from Tuple - by pajd - Oct-06-2022, 02:30 PM
RE: Pulling username from Tuple - by pajd - Oct-06-2022, 02:25 PM
RE: Pulling username from Tuple - by rob101 - Oct-06-2022, 02:31 PM
RE: Pulling username from Tuple - by pajd - Oct-06-2022, 02:36 PM
RE: Pulling username from Tuple - by rob101 - Oct-06-2022, 02:48 PM
RE: Pulling username from Tuple - by pajd - Oct-06-2022, 03:09 PM
RE: Pulling username from Tuple - by rob101 - Oct-06-2022, 03:17 PM
RE: Pulling username from Tuple - by pajd - Oct-06-2022, 03:29 PM
RE: Pulling username from Tuple - by rob101 - Oct-06-2022, 03:31 PM
RE: Pulling username from Tuple - by pajd - Oct-06-2022, 03:34 PM
RE: Pulling username from Tuple - by rob101 - Oct-06-2022, 03:40 PM
RE: Pulling username from Tuple - by pajd - Oct-06-2022, 03:44 PM
RE: Pulling username from Tuple - by deanhystad - Oct-06-2022, 07:52 PM
RE: Pulling username from Tuple - by pajd - Oct-06-2022, 08:46 PM
RE: Pulling username from Tuple - by rob101 - Oct-06-2022, 09:29 PM
RE: Pulling username from Tuple - by deanhystad - Oct-07-2022, 02:14 AM
RE: Pulling username from Tuple - by pajd - Oct-07-2022, 01:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pulling data from mssql to PG DB hartman60 1 494 Jan-31-2025, 12:26 PM
Last Post: hartman60
  checking username newbexx 3 1,117 Jun-17-2024, 11:42 AM
Last Post: Pedroski55
  AttributeError: '_tkinter.tkapp' object has no attribute 'username' Konstantin23 4 5,840 Aug-04-2023, 12:41 PM
Last Post: Konstantin23
  Pulling Specifics Words/Numbers from String bigpapa 2 1,588 May-01-2023, 07:22 PM
Last Post: bigpapa
  Having trouble installing scikit-learn via VSC and pulling my hair out pythonturtle 1 1,523 Feb-07-2023, 02:23 AM
Last Post: Larz60+
  (Python) Pulling data from UA Google Analytics with more than 100k rows into csv. Stockers 0 1,950 Dec-19-2022, 11:11 PM
Last Post: Stockers
  Hiding username and password on sql tantony 10 6,968 Oct-21-2022, 07:58 PM
Last Post: wavic
  pulling multiple lines from a txt IceJJFish69 3 3,446 Apr-26-2021, 05:56 PM
Last Post: snippsat
  code with no tuple gets : IndexError: tuple index out of range Aggam 4 4,368 Nov-04-2020, 11:26 AM
Last Post: Aggam
  Pulling Information Out of Dictionary Griever 4 3,984 Aug-12-2020, 02:34 PM
Last Post: Griever

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020