Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Confused with 'flags'
#1
Greetings!
I'm confused about how to use 'flag', I read I can use it instead of 'ELSE'.
I'm playing with the code below to see how I can use "flags" but it does not work.
with open ('C:/02/somefile.txt','r') as f :
    flg = False
    for l in f :
        if '123' in l : 
            print (l)        
            flg = True 

    if flg == False :
        print (" 'ELSE' -->> "+l)
Thank you.
Reply


Messages In This Thread
Confused with 'flags' - by tester_V - Apr-10-2021, 08:31 PM
RE: Confused with 'flags' - by jefsummers - Apr-10-2021, 09:00 PM
RE: Confused with 'flags' - by tester_V - Apr-10-2021, 09:27 PM
RE: Confused with 'flags' - by menator01 - Apr-10-2021, 11:18 PM
RE: Confused with 'flags' - by tester_V - Apr-10-2021, 11:56 PM
RE: Confused with 'flags' - by menator01 - Apr-11-2021, 03:09 AM
RE: Confused with 'flags' - by tester_V - Apr-11-2021, 03:47 AM
RE: Confused with 'flags' - by ndc85430 - Apr-11-2021, 04:56 AM
RE: Confused with 'flags' - by tester_V - Apr-11-2021, 06:00 AM
RE: Confused with 'flags' - by deanhystad - Apr-11-2021, 01:15 PM
RE: Confused with 'flags' - by tester_V - Apr-12-2021, 03:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  String int confused janeik 7 1,077 Aug-02-2023, 01:26 AM
Last Post: deanhystad
  I am confused with the key and value thing james1019 3 966 Feb-22-2023, 10:43 PM
Last Post: deanhystad
  Pandas confused DPaul 6 2,562 Sep-19-2021, 06:45 AM
Last Post: DPaul
  is and '==' i'm confused hshivaraj 6 2,713 Sep-15-2021, 09:45 AM
Last Post: snippsat
  Regex - Pass Flags as a function argument? muzikman 6 3,592 Sep-06-2021, 03:43 PM
Last Post: muzikman
  Passing flags to python script, through a function xbit 4 3,980 Apr-20-2021, 06:32 AM
Last Post: ndc85430
  Simple Tic Tac Toe but I'm confused Izith 1 2,195 Sep-26-2020, 04:42 PM
Last Post: Larz60+
  I am really confused with this error. Runar 3 3,018 Sep-14-2020, 09:27 AM
Last Post: buran
  Confused on how to go about writing this or doing this... pythonforumuser 3 2,492 Feb-10-2020, 09:15 AM
Last Post: snippsat
  Dazed and confused... RodNintendeaux 10 7,504 May-28-2017, 01:32 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

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