[Solved] Python script counting lines in multiple text files in one directory and producing simple report

Your names dict looks like that: { ‘file1.txt’: 30, ‘file2.txt’: 26, ‘file3.txt’: 19, ‘file4.txt’: 19 } So you’d just have to start from that and follow with: from collections import defaultdict lines = defaultdict(int) for val in names.values(): lines[val] += 1 for k, v in lines.items(): print(“Files with {} lines: {}”.format(k, v)) This will print … Read more

[Solved] How to get results from php to html option?

I don’t really understand what you mean. But did you mean something like this: <html> <body> <select> <?php $root = realpath($_SERVER[“DOCUMENT_ROOT”]); include “$root/config.php”; $something1 = “something1”; $something2 = “something2”; $stmt = $pdo->prepare(‘SELECT DISTINCT from_mysql FROM customers WHERE something1 = :something1 AND from_mysql != :something2 ORDER BY from_mysql’); $stmt->execute(array(‘:something1’ => $something1, ‘:something2’ => $something2)); $results = … Read more

[Solved] How to change audio tag when I click on radio button?

Updated: <!DOCTYPE html> <html> <head> <title>Events</title> </head> <body> <input type=”radio” value=”test2″ name=”rad” onclick=”boom(this.value);”>test2 <input type=”radio” value=”test3″ name=”rad” onclick=”boom(this.value);”>test3 <input type=”radio” value=”test4″ name=”rad” onclick=”boom(this.value);”>test4 <br> <audio id=”audio” controls> <source src=”” type=”audio/ogg”> <source src=”” type=”audio/mpeg”> <source src=”https://stackoverflow.com/questions/37552235/test1.wav” type=”audio/wav” id=”sound”> </audio> <script type=”text/javascript”> function boom(val){ var audio = document.getElementById(“audio”); var aud = document.getElementById(“sound”); aud.src=val+”.wav”; audio.load(); } </script> </body> … Read more

[Solved] Run python code from a certain point

It sounds from your question like you have some lines at the beginning of a script which you do not want to process each time you run the script. That particular scenario is not really something that makes a lot of sense from a scripting point of view. Scripts are read from the top down … Read more

[Solved] “$ is not defined” jQuery bottom with PHP include

If you replace the “$(function(){” section with window.onload you can ensure that all script files have been loaded before attempting to fire your function. However, be aware that this fires much later that jQuery’s document.ready. jQuery’s method fires when the dom is loaded whereas window.onload waits until the whole document and it’s scripts have been … Read more

[Solved] Python performance [closed]

I made a great experience with Cython (Another thing than CPython…). You can make plain C code out of your program, compile it to an extension and just run it from another Python file. See this question from me for more information on building an extension including numpy: How to create a .pyd file?. Sample: … Read more

[Solved] Convert Html to pdf with images

$(‘#showPdf’).click(function() { var pdf = new jsPDF(); pdf.addHTML($(“#divContent”), function() { var blob = pdf.output(“blob”); window.open(URL.createObjectURL(blob)); }); }); $(‘#downloadPdf’).click(function() { var pdf = new jsPDF(); pdf.addHTML($(“#divContent”), function() { pdf.save(‘pageContent.pdf’); }); }); <script src=”https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js”></script> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js”></script> <div id=”divContent” style=”background-color: white; padding:20px 25px”> <h3>SEA MINK</h3> <p>The sea mink (Neovison macrodon) was a mammal from the eastern coast of … Read more