15,185 Topics
| |
I just wanted to show the basic usage of docopt, a module that makes parsing command-line arguments so much easier. I'm not affiliated with the creators of docopt, but I'm certainly thankful for their work and happy to post this little snippet. I will point you to [docopt.org](http://docopt.org) for more … | |
For those of you who have worked with NMMAP before, Im raising an error each time I run my script. I'm using <python3 nmap_scanner.py -H 10.50.60.125 -p 21, 1720> at the command line to execute the script, and im running into the error: Traceback (most recent call last): File "nmap_scanner.py", … | |
with terminal is there a way for me to get a list of names that are already taken? like for things like variables and filenames `import` so I can't accidentally name something that will make a bug | |
the formula for naive bayes is P(A/B1,B2,B3...Bn) = [ P(A) * P(B1/A) * P(B2/A) * . . . P(Bn/A) ] / [ P(B1) * P(B2) *....P(Bn) ] i am working on a project to classify email as spam or not. i have a large data set. i am using nltk … | |
when are we supposed to use StubOutWithMock() ? | |
I need to convert python code to javascript. do anyone here know javascript? please give your mail id i will sent the python code to your mail! thanks in advance :) | |
I want to learn about `def` because that looks very the most intriguing how you can make it kind of like reusable but when I was learning I had come some problems with understanding def main(): #renewable code main() if __name__ == "__main__": main() I don't understand what `__name__` and … | |
Hi I downloaded keyboard event and its work very fine. Its capture all keystroke and print it. My question is how can we do it to save to file (for example C: \log.txt) instead to print out . To write out f=open('c:\log.txt','w') but where can I put it :)? import … | |
I have a qucik question for you guys. Is there a way to change the taskbar icon? Im done with my game and im gonna show it in class on tuesday 14 and I just thought it would be cool to have an icon that represents the game and not … | |
Here I am using askopenfile to upload a (text)file, I also wanted to display the file name next to the upload button and then I want to read its contents and convert it to another language. Say for example if the document is in English I want to convert it … | |
I have a serious problem with my game right now, after each kill I get the game starts lagging more and more. I thought it was because he was drawing the same thing twice and stuff and went trough some functions that was useless. But I cleaned it up as … | |
Hello how can i make a change calculator? for exmaple i want to buy an item thet cost 5.89$ and in canada no more 1 cents so how can round the number to 5.90? | |
Hello, Has anyone ever repeatedly wrote to the same text file, using the append mode, and when examining the text file, several lines were missing? Here are the specifics to my code: 1. Each line in the output, the text file, contains data from one experimental session (e.g. the session … | |
Hello , I wanted to ask if It is possible to create a Python programm that turnes on a server , with interfaces on users machines , connecting to a database ? Actualy , i'm asking about a better way to use databases with Python , thank you . | |
Please Help me to convert this python code to C# # avg_visits = [75, 30, 18, 17, 26, 40, 67, 82] mixes = [0]*50001 mixes[0] = 1 for n in avg_visits: for i in range(0,50001): if (i+n <= 50000): mixes[i+n] = mixes[i]+mixes[i+n] print mixes[500] print mixes[2000] print mixes[50000] | |
hi, I have the following dict which I want to write to a file in binary: data = {(7, 190, 0): {0: 0, 1: 101, 2: 7, 3: 0, 4: 0}, (7, 189, 0): {0: 10, 1: 132, 2: 17, 3: 20, 4: 40}} I went ahead to use the … | |
# This is an advanced guess the number game. import random # The very basis of this game. import math # Used for math.ceil import time # Used to split up long portions of text. def errorDisplay(errorCode): if errorCode == '1': print('\n\n\nError ' + errorCode + ': unlockedGameModes outside of … | |
This, of course, is not my code. It's from my object oriented programming course book. During class I ran the program and it worked a good 75% of the time without making any changes. For some reason, when I run it at home(either on python 2 or python 3) it … | |
Okey so I need help with how to make a health bar that starts out full with green color but then when I lose hp it get's smaller and smaller. I have now that my hp is 100, and then when I get hit by a bullet from the boss … | |
Hi, I have a simple editor with wx.textCtrl MULTILINE as my editing area. Nothing fancy, except I can't do a "PrintPreview" or a "Print". On the preview it shows a blank screen and the Print prints out a blank piece of paper. The "text" appears on my editor and a … | |
Using latest versions of Python (2.7) and wxPython(2.8) I get the folowing error when I "PreviewText" using "HTMLEasyPrinting". In the __init__ I have tried "parentWindow=None", "parentWindow=frame", etc. No Luck. Does anyone have a workaround for this annoying problem. (It is documented elsewhere => "FRAME_FLOAT_ON_PARENT") RR C:\K>Print_Dialog.py Traceback (most recent call … | |
Could anyone help me in understanding what does below Python code do? Also please help me in converting it into Java. import random howMany = random.randint(0,1000) stats = {} for i in range(howMany): value = random.randint(0,500) stats.setdefault(value,0) stats[value]+=1 for item in stats: if stats[item] > 1: print item | |
I have a method that does not return anything , but it makes a call to another method that returns a value like def apply(): #set some defaults try: script = _getScript() except Exception, ex: raise Exception(ex) node = [xyz for xyz in myLst] # myLst is a global list … | |
Im making a 2D platformer-ish shooter its really simple and not much effort put in it, it is my first game Im making in python and its for a school project and needs to be finnised really soon. Everything is working just fine but Im having problem with some collision … | |
I am using django1.3.7 for developing a web application.How to display a datepicker using jquery.I am having jquery datepicker which is working fine with html.The only requirement is i am using model form,so how to render the datepicker is my question.Kindly help me in this problem. Thanks | |
Ich habe hier folgendes Teilstück, wo Daten aus einer Sonde empfangen werden: for i in range(12): err,data=dev.GetData() print data f.write(data) Wenn cih das ausführe bekomme ich die Fehlermedung: expected a character buffer object | |
Hi to all, I'm looking for a solution to create a front-end in python for an app. I've some experience with Tk (but it's not fundamental i would like to use wxpython) and standard widget, but now i'm in a project too complicated for me. The app is like a … | |
Hi I'm new to Python and have the following problem. I have a excel file (csv format) that I want to open and display as a 2d list. I can read the file but can not get anyother output other than the colum headings as a single letter [h][e][a][d][i][n][g] I … | |
Here is a short Python program using the module pygame that lets you play a midi music file. Midi files are instrumental music files that pack a lot of good sound into a small file. They are very popular with web page designers. | |
I want to print the time in one of my program's but the time is an hour wrong, this is what i'm using. from time import gmtime, strftime strftime("%Y-%m-%d %H:%M:%S", gmtime()) it gives '2013-05-06 09:06:25 ' where the current time is 10:06:25. |
The End.