15,185 Topics

Member Avatar for
Member Avatar for chriswelborn

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 …

1
3K
Member Avatar for clouds_n_things

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", …

Member Avatar for chriswelborn
0
2K
Member Avatar for nouth

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

Member Avatar for chriswelborn
1
626
Member Avatar for shanki himanshu

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 …

Member Avatar for shanki himanshu
0
159
Member Avatar for krystosan
Member Avatar for siss

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 :)

Member Avatar for TrustyTony
0
173
Member Avatar for nouth

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 …

Member Avatar for nouth
0
505
Member Avatar for tony75

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 …

Member Avatar for tony75
0
779
Member Avatar for Necrozze

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 …

0
173
Member Avatar for Varunkrishna

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 …

Member Avatar for woooee
0
2K
Member Avatar for Necrozze

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 …

Member Avatar for Necrozze
0
1K
Member Avatar for vadimak

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?

Member Avatar for vadimak
0
432
Member Avatar for Social_psych

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 …

Member Avatar for Social_psych
0
219
Member Avatar for Ismatus3

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 .

Member Avatar for Ismatus3
0
234
Member Avatar for tengmat

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]

Member Avatar for Lucaci Andrew
0
1K
Member Avatar for ggsr45

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 …

Member Avatar for ggsr45
0
366
Member Avatar for Aethir

# 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 …

Member Avatar for Aethir
0
279
Member Avatar for dp121307

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 …

Member Avatar for dp121307
0
529
Member Avatar for Necrozze

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 …

Member Avatar for Necrozze
0
1K
Member Avatar for robinlrandall

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 …

Member Avatar for robinlrandall
0
2K
Member Avatar for robinlrandall

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 …

Member Avatar for robinlrandall
0
359
Member Avatar for aadarsh_khare

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

Member Avatar for JasonHippy
-1
274
Member Avatar for krystosan

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 …

Member Avatar for krystosan
0
3K
Member Avatar for Necrozze

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 …

Member Avatar for Lucaci Andrew
0
562
Member Avatar for Sivaram R

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

Member Avatar for Sivaram R
0
262
Member Avatar for manja.her

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

Member Avatar for TrustyTony
0
180
Member Avatar for gbonline

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 …

Member Avatar for slate
0
265
Member Avatar for goatroxley

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 …

Member Avatar for rrashkin
0
359
Member Avatar for vegaseat

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.

Member Avatar for diliupgabadamudalige
0
5K
Member Avatar for aVar++

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.

Member Avatar for Schol-R-LEA
0
246

The End.