this question has answer here: asking user input until give valid response 9 answers new programmer here, , let me start off code have. try: f = input("please type in path file , press 'enter'") file = open(f,'r') except filenotfounderror: f = input("file not found please try again.") what i'm trying accomplish, if user enters wrong file, keep asking user try again. maybe shouldn't using try/except? embed statement inside while loop. break if file opened successfully. while true: try: f = input("please type in path file , press 'enter'") file = open(f, 'r') break except filenotfounderror: print('file not found') note: may need handle other exceptions ioerror (even though, there file, may not possible open - because of p...
i'm completing assignment school in need receive information html form ruby cgi script, , use fadein() jquery method display it. my script looks like: #!/usr/local/bin/ruby -w require 'cgi' cgi = cgi.new('html4') cgi.out{ cgi.html{ cgi.head{cgi.title{"this test"}+ cgi.style{"p{color = red;}"}} + cgi.body{cgi.p{"try " + cgi['ffname'] + ", did work?"}} } } this of test code, make sure server working way thought was. when try , use like: puts "<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>" the server refuses run it, guess that's not allowed. i'm still beginner ruby cgi class. how can reference jquery library these cgi methods? similar how sending html client side, send javascript code client side. javascript code contain call jquery function.
Comments
Post a Comment