15,181 Topics

Member Avatar for
Member Avatar for jancho1911

Hi!!! I am making a program that is supose to use Naive bayes classifier to classify text from few categories. This is the best i can do to explain, here is what i have done so far: import math d=open('D.txt', 'r') di=open('kat1.txt', 'r') posleden = di.readlines() total = d.readlines() Di …

Member Avatar for callmerudy
0
213
Member Avatar for prettyspinster

Hello, I am very new to python and have been going through all over the web to try to figure out my problem. I have small script that I would like to do something simple with. I have a number of files called soemthing like (myFile00.txt, myFile01.txt,...). Mainly this is …

Member Avatar for prettyspinster
0
121
Member Avatar for shean1488

Hi everybody, I'm trying to do a simple login for a web site, and everything looks fine except one thing, when I enter a name and a password for a superuser I got "403 Forbidden" error. here is my login.html: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> …

0
103
Member Avatar for prashanthmukund

I just came across this question. All the solutions given are in PERL for this question. I thought I can learn solving this in Python as I could learn many thing by solving this problem. But I am stuck. The question is: You are working at a grocery store which …

Member Avatar for TrustyTony
0
119
Member Avatar for G_S

Hello. I am working on a personal project. It's basically a program for changing specific tags from certain HTML files. So far, everything works. The GUI and the logic a work but I know the main function is wrong because it looks like this: def tag_remove(HTML_string): clean_HTML = a_string.replace('<b>', '').replace('<i>', …

Member Avatar for G_S
0
7K
Member Avatar for Frensi

Hello all, I'm very new to programming and Python so please forgive my ignorance. i'm just wondering if it's possible to have two strings on one elif. Something like this. name = input("What is your full name: ") if name == "Jack Neilson": print("I like your name") elif name == …

Member Avatar for TrustyTony
0
150
Member Avatar for TrustyTony

What this produces and why? >>> a = 2 >>> b = 5 >>> exec "print(a+b)" in dict(a=6, b=9)

Member Avatar for TrustyTony
1
183
Member Avatar for frivolous

hi, i made a music player it opens almost all the songs but while opening some songs it gives this error : A:/Chrome Downloads/Jhalla_Wallah_(Remix)_-_(MusicTub.Com).mp3 Error 277 for "open "A:Chrome DownloadsJhalla_Wallah_(Remix)_-_(MusicTub.Com).mp3" alias mp3_0.878022650438": A problem occurred in initializing MCI. Error 263 for "set mp3_0.878022650438 time format milliseconds": The specified device is …

Member Avatar for frivolous
0
5K
Member Avatar for zmjman08

Hi, I'm trying to take two text files, compare them, then output the matches into a new text file. I've read the thread started by the1last, but that's outputting differences, not matches. I just started learning about python a couple days ago, so I don't know anything about what syntax …

Member Avatar for santosh2430
0
14K
Member Avatar for HankReardon

Hello, Is there a Python tutor in this group who would be willing to help me with about 3 - lines of code. I have an assignment due on the 4th of July and am a little stuck. Thank You, HR

Member Avatar for TrustyTony
0
101
Member Avatar for HankReardon

Hello, I am having trouble writing a variable named UpperCaseSentence outside of a for loop in this particular code snippet. It runs fine while in the loop but not while out of the loop. Can anyone shed some light on this dilemma for me. Here is the code. Thank you …

Member Avatar for HankReardon
0
3K
Member Avatar for HTMLperson5

Is it possible to create a scripting language using Python? Interactive Shell is fine, just something which comes close to a scripting language? Which allows the user to script some sort of functionality? Maybe more that just a console like this: def main(): cmd = (raw_input('#>>')) if cmd=="do_stuff": print "Ok, …

Member Avatar for HTMLperson5
0
1K
Member Avatar for johndb

I have downloaded vpython and try to run one of the examples included with the program. [CODE]from visual import * floor = box(length=4, height=0.5, width=4, color=color.blue) ball = sphere(pos=(0,4,0), color=color.red) ball.velocity = vector(0,-1,0) dt = 0.01 while 1: rate(100) ball.pos = ball.pos + ball.velocity*dt if ball.y < 1: ball.velocity.y = …

Member Avatar for alex.avak
0
299
Member Avatar for vy_007

I have to write an application in python for image processing.I have made scripts of all the image editing options. Now I want to add GUI in it. I want a window where I can give the path of an image on which I want to perform the editing! At …

Member Avatar for TrustyTony
0
5K
Member Avatar for Acidz

Hi, People... I have a question about reading xls files in python then parsing it to sqlDatabase. The thing is, that the xls file(pricelist) we as a company use are ordered and it's pretty easy to sort that out. The problem comes with xls files from other companies. (We are …

Member Avatar for Acidz
0
353
Member Avatar for HTMLperson5

This is a program using the `urllib` module to find the (html/any client-side script) source code of any website which exists. Have fun!

Member Avatar for M.S.
0
169
Member Avatar for HTMLperson5

Hi guys, I am having a problem with the following code: #Health set here def win(): import time print "You win!" print "Thanks for playing" time.sleep(10) quit() def lose(): import time print "You lose!" print "Thanks for playing" time.sleep(10) quit() from random import randint pos_damage = randint(15,472) en_health = 1000 …

Member Avatar for HTMLperson5
0
271
Member Avatar for Testa

Hi all! Is my first post here and well, im very new with python (just aroun 10 days). I did the famous "Guess my number" game. (Python pick up a number and user must guess it). All right, i have not problems with this. But now im trying in the …

Member Avatar for Testa
0
213
Member Avatar for tarun123

hey if anyone knows how to open open window when we click on open option in menu bar of gui which is created by boa constructor.

0
158
Member Avatar for trishtren

Hey, Iv been looking around google for the past few days to find ways to embed python 3.2 into my c++ application. I however want interpeter to be compiled into my application, so i can merely distribute one exe file without relying on the user to install python. However the …

Member Avatar for TrustyTony
0
281
Member Avatar for efth

I recently left Python behind to pick up Java. In Python, a variable defined in a function could not be called outside of the function. But you could at least let the function return a value, which could be a variable defined in the function. When a variable is defined …

Member Avatar for jLocke
0
250
Member Avatar for werydude

Hi. I'm a python noob who codes for fun, so please only critize me if you're trying to help. I'm on python 2.7 and built this code for fun. (dont ask what the questions are mean. its private info) Start = True while Start: print "Would you like to play …

Member Avatar for TrustyTony
0
513
Member Avatar for HTMLperson5

Well, in python I was planning to do something like this: >> echo text text >> But I just cant find a way to do it! I know that for user input i will use `input()`, but how do I get it to echo the text specified?

Member Avatar for Gribouillis
0
328
Member Avatar for TrustyTony
Member Avatar for Ene Uran
0
205
Member Avatar for fatalaccidents

Hey guys, I am a non-root user on a linux machine and I'm working with mpi4py. I have an alias set to my python-2.7 that has all of the modules that I loaded into it. So if I type 'python' and then 'from mpi4py import MPI' everything is fine. The …

Member Avatar for TrustyTony
0
185
Member Avatar for mahela007

Is it possible to keep writing the output of a program on the same line instead of moving to a new line every time? The output should be written over the preceding output. An example would be a kind of counter... say a number that counts from 1 to 10 …

Member Avatar for Lucaci Andrew
0
11K
Member Avatar for KY_Fan

This class just keeps getting worse. My next lab he had us do is this, **"Write a program that computes the intersection of a circle with a horizontal line and displays the information textually and graphically".** He gave us absolutely no help or anything to do this. He just said …

Member Avatar for KY_Fan
0
419
Member Avatar for hughesadam_87

Hi, If I have a list of strings, it's easy to output them using .join(). For example: mylist=['hi', 'there', 'girls'] myout='\t'.join(mylist) What I want to know is if there is a builtin python method that acts like join, except it automatically converts ints and floats to strings without giving a …

Member Avatar for TrustyTony
0
120
Member Avatar for 4evrmrepylrning

I have this: import re subs = [] def subcons(data): match = re.search(r'(<[a-z]{3})', data) if match: subs.append(match.group(0)) data = data.replace(match.group(0), '') subcons(data) else: print data return data, subs input = 'ABC <uvw <xyz some random data' e, f = subcons(input) print e print f The print statement in the else …

Member Avatar for TrustyTony
0
210
Member Avatar for TrustyTony

Do you get content of oper right before trying it out? oper = ['plus', 'minus', 'times'] oper.extend('divide') How about do you know what happens when you run this? Big bang? ;) print('a' 'b' 'c') And this is same, isn't it`? c = 'c' print('a' 'b' c)

Member Avatar for snippsat
1
182

The End.