here trying do: trying solve issue has wrapping in text file. i want open txt file, read line , if line contains want contain, check next line see if not contain in first line. if not, add line first line. import re stuff = open("my file") line in stuff: if re.search("from ", line): first = line print first if re.search('from ', handle.next()): continue else: first = first + handle.next() else: continue i have looked quite few things , cannot seem find answer. please help! i try this, invalid triples of "from " , not elegant @ all. lines = open("file", 'r').readlines() lines2 = open("file2", 'w') counter_list=[] last_from = 0 counter, line in enumerate(lines): if "from " in line , counter != last_from +1: last_from = counter current_count = counter if current_coun...
i'm trying figure out way mean stack application keep track of users have paid grant them access portion of webpage. i've considered several options: stripe customer id, mongodb record, , html attribute can update. my mean stack keeps track of users jwt, , appears stripe assigns them own customer id isn't ideal. can done jwt opposed forced cutomer id? mongodb record. i'm thinking might best option. when new user has been created, i'll give attribute of haspaid = no. update record of customer when payment submitted. guess run script set unpaid each day? html element/attribute. don't know if possible; cool create key carried during html session after payment received. if person closers browser session closed? i'm looking guidance on 3 options determine if they're best solution. also, if has suggestions alternatives, i'm ears! thanks in advance. speaking generally, common approach second one: use attribute in data model indicates ...
i have 3 buttons , 1 frame layout works container 3 different fragments in layout. when click button a, fragment opens, , on clicking button b fragment b replaces fragment a. same c. so question - suppose if user clicks button , fragment opens, , if clicks button again fragment open. fragment should gone. code looks similar onclicklistener listener = new onclicklistener() { public void onclick(view view) { fragment fragment = null; if(view == findviewbyid(r.id.button1)){ fragment = new fragmentone(); } else { fragment = new fragmenttwo(); } fragmentmanager manager = getsupportfragmentmanager(); fragmenttransaction transaction = manager.begintransaction(); transaction.replace(r.id.output, fragment); transaction.commit(); } }; button btn1 = (button)findviewbyid(r.id.button1); btn1.setonclicklistener(listener); button btn2 = (button)findviewbyid(r.id.button2); btn...
Comments
Post a Comment