Posts

How to write data to a text file in python? -

this have far: def main(): infolist = [] count = 0 while true: firstname = input('please enter first name: ') mystring = str(firstname) lastname = input('please enter last name: ') mystring2 = str(lastname) telephoneno = input('please enter telephone number: ') mystring3 = str(telephoneno) contiinue = input('continue (y = yes): ') if contiinue == 'y': count = count + 1 else: print ("file written") break file = open('filename', 'a'); file.write(data.to_string()); file.close(); main() i'm trying program write input text file, allow new information added added text file, not erase whats been written. every time try run program there's problem main() , name error, data not defined? to add @clodion's answer use with keyword def main(): infoli...

angular - Multiline string with typescript - Angular2 -

Image
i'm angular2 beginner , i've written piece of code in dev/app.component.ts it works, when go browser "max brown displayed". want write template part on different lines this: but error in chrome console: uncaught typeerror: cannot read property 'split' of undefined wrap text in ` (backticks) instead of single quotes ' , can span multiple lines. var mystring = `abc def ghi`;

Issue when migrate from spring 3.2.2 to 4.2.3 Release -

trying upgrade trying upgrade `spring` 3.2.2 4.2.3. release facing below issue: [2/5/16 17:13:54:807 ist] 00000055 webapp com.ibm.ws.webcontainer.webapp.webapp log srve0292i: servlet message - [citicomp_war#citicomp.war]:.no spring webapplicationinitializer types detected on classpath com.ibm.ws.webcontainer.webapp.webapp log srve0292i: servlet message - [citicomp_war#citicomp.war]:.initializing spring root webapplicationcontext [2/5/16 17:13:57:930 ist] 00000055 webapp e com.ibm.ws.webcontainer.webapp.webapp notifyservletcontextcreated srve0283e: exception caught while initializing context: {0} org.springframework.beans.factory.beandefinitionstoreexception: failed parse configuration class [com.citigroup.ces.citicomp.boesdk.datatype.sdkconfig]; nested exception java.io.filenotfoundexception: not open servletcontext resource [/sdk_config.properties] ...

regex - python raw string escaping character -

a noob question. reading documentation on use of regexes in python. under impression using raw string treat '\' , not consider whatever following escape sequence. in example reading, however, >>> phonenumregex = re.compile(r'(\(\d\d\d\)) (\d\d\d-\d\d\d\d)') >>> mo = phonenumregex.search('my phone number (415) 555-4242.') >>> mo.group(1) '(415)' >>> mo.group(2) '555-4242' clearly, author has escaped '(' '\' . want understand how. thought putting 'r' @ bring treat '\' no differently. the \ in raw string literal literal \ , need use escape shorthand character classes , special regex characters with. the ( beginning of grouping construct , there must closing unescaped ) . these (...) never part of match . \( , \) literal ( , ) , these part of match. think of regex engine customer delivered string. re requires \d . when use "\d", python thinks es...

Hi,my application running fine manually when i run test in jmeter it sends 404 erros -

my application running fine manually, when run test in jmeter sends 404 errors , getting following error in jmeter console window uncaught exception java.lang.unsatisfiedlinkerror c:\progfiles\java\jre\bin\jpeg.dll not valid win 32 applictaion for jemter java above 1.6 required, refer prerequisotes http://jmeter.apache.org/usermanual/get-started.html . jmeter java application, jre or sdk first needs installed java_home environment variable. then find jmeter.bat file , add following lines @ top: set java_home=c:\java -- java installation folder set path=%java_home%\bin;%path

vb6 - VBA.FileSystem Dir -

in vb6 code m using vba.filesystem.dir file name directory path. returning empty string. please find below code call getfile.showopen //getfile commondialog control of vb6 txtfile.text = getfile.filetitle //correct file name returned if dir(getfile.filename) == "" // conditions come true..but ideally should not!!! but file resides in network location. can there permission issue? if yes, how see file in getfile.showopen dialog , dir() returns empty string? any on wrong in above code consider these points: afaik, double equal ( == ) not supported in vb6 dir = (whatever) can return "" if whatever directory or hidden file you trap name using if dir(whatever, vbdirectory or vbhidden or vbarchive or vbnormal) but still have test each see was. btw, it's better have variable receive dir , inspect that, rather inspecting dir itself. dim stgt$ stgt = dir(whatever) also, btw, alternative chking each type to inspect filelen. curi...

angularjs - Angular ui-grid: define columns in template -

the ui-grid documentation tells define columns in controller, this: $scope.gridoptions = { columndefs: [ { field: 'id', displayname: 'ref', width: "60" }, { field: 'title', displayname: 'title', width: "200" } ] } while works fine, feel belongs in template. there way setup columns this: <div ui-grid="gridoptions" class="mygrid" style="width:800px; height: 600px"> <ui-column field="id" width="60">ref</ui-column> <ui-column field="title" width="200">title</ui-column> </div>