15,185 Topics
| |
I compiled a program in python, but the second I open it, there is a flash of the error, but then the cmd window closes. | |
I have 2 functions, one of which works and one of which doesn't. I do not understand this, because the only difference is that the second function puts in just the name of the variable, where the 1st function puts in the value. There is only one line to build … | |
I have to create a python program for class- the instructions are- Write a payroll program that pays time and a half for anything over 40 hours. This should have 3 functions in #addition to main. Which I did without the 3 funcitons. def main(): hours = float(input('How many hours … | |
Hello guys, Please how can I read xml files and extract image store in it and save it as .jpeg in a specified folder. Also how to export all the other fields to .csv or .txt file. Thank you. | |
I have a csv that needs to be put into a database format so I can sort and count the data. My approach has been to use python csv and sqlite modules. I am communicating with the database and creating one of the 2 tables. Second table has many more … | |
import os import re import sys sys.stdout=open('f1.txt','w') from collections import Counter from glob import glob def removegarbage(text): text=re.sub(r'\W+',' ',text) text=text.lower() return text folderpath='d:/induvidual-articles' counter=Counter() filepaths = glob(os.path.join(folderpath,'*.txt')) num_files = len(filepaths) with open('topics.txt','r') as filehandle: lines = filehandle.read() words = removegarbage(lines).split() counter.update(words) for word, count in counter.most_common(): probability=count//num_files print('{} {} {}'.format(word,count,probability)) … | |
Hi all, First, I do not know what is the appropriate forum, here or in Python forum!! I am new user in Ubuntu and I want install Python to complete installation other program. After I downloaded Python version 2.7.5 , and uncompress the file in the my folder, I go … | |
Hi All, Using pydbg I'm opening certain files(ex. c:\\myfile.txt) within a win32 application(Ex. c:\\notepad.exe) in this way. dbg = pydbg() dbg.load("c:\\notepad.exe", "c:\\myfile1.txt") So my question is, if the target application(Ex. c:\\notepad.exe) is already running then,then is it possible to open a another file(For example c:\myfile2.txt ) within the same application … | |
Hy, I have a beginner question: when using PyDev should all my programs be inside a package or not? | |
Hi How to get the path of home directory in windows? I have the script that write log.txt in my windows 7 Desktop. How can I change path in python to write log.txt in homedir directory? Is there any way to do it? I tried with those 2 methods But … | |
I recently got a new macbook pro, can anyone suggest me a really good free python IDE i can use on OS x ? | |
Hello everybody. Lately, I'm having a problem with PyDev which is driving me crazy: It is failing to connect to the Python console, therefore, many built-ins appear as errors (None, __name__, the os modules, etc.). I have tried downgrading PyDev, I have tried disabling IPv6, I have tried disabling my … | |
I tried to install python on xp, however pythonw.exe would not initialize. I think there is a registry setting conflict with either, lua or mediamall (which uses lua heavily). Possibly, it could be another issue. It also makes me wonder if Python could be a security risk. I have always … | |
How do i finda spl character in a string and return found one..? | |
Here is a code snippet that calculates the probability of the outcome of a two sided game based on the capability of each side. I used it in my football league simulator program Could be used in any number of simulators which involve two parties. For equally strong parties, the … | |
Hi Need help with my python functions Where or How can I put def get_startupapps_path(): function in def install(): ? so that when program copy it self to windows homdir,it will be start my ipScript every time at windows startup.Becuse my machine has dynamisk IP-adress. import sys import os import … | |
Hello, I'm trying to look at elements of an xml file. I have one on hand but i'm trying to write a utility for extracting info about the MessageId and KeyID, Serialnumber along with a host of other information. Basically, when I've got all of my ducks in a row … | |
I am going to compile a small python program in order to use Queue to produce a random with a thread. For example, using one thread to print odd number, while another thread to print even number. Here is my codes, please offer me some advice: import threading import random … | |
Guys, below is a part of an Object description in an application I am trying to code. I am using Tkinter for GUI. The Tkwindow hangs as soon as the "print self.gs" instruction is executed. Can it be rectified? Any help will be appreciated def while_time(self): pass def gameplay(self): self.gs=self.get_schedule()#Schedule … | |
I have a model that looks like ... class Person(models.Model): name = models.CharField(max_length=50) birthday = models.DateField() def __unicode__(self): return u'%s %s' % (self.name, self.birthday) class Address(models.Model): person = models.ForeignKey(Person) address = models.CharField(max_length=150) def __unicode__(self): return u'%s %s' % (self.person, self.address) class Anniversy(models.Model): person = models.ForeignKey(Person) anniversy = models.DateField() def __unicode__(self): … | |
Hello, I'm working with PostgreSQL and Python to obtain 2 columns froma database and need to print it in a specific format. Here is my current code. #!/usr/bin/python # -*- coding: utf-8 -*- import psycopg2 import sys con = None try: con = psycopg2.connect(database='DB', user='ME', password='1234') cur = con.cursor() cur.execute(" … | |
I've been given a pile of reports generated by someone who is no longer with us. They each begin with a decimal date and time like this: "41433.662413","41401,250002" I have tried many different methods using datetime and can't figure out how to recover the date. I know (because of a … | |
I am using PyInstaller now for building, but I still have a problem! My error is as follows: Traceback (most recent call last): File C:/Users/Jack/Desktop/pyinstaller-pyinstaller-61571d6/PyInstaller/Build.py from PyInstaller.loader import pyi_archive, pyi_carchive ImportError: cannot import name pyi_archive Please help! I am very frustrated with no way to compile my scripts! | |
I compiled a script with py2exe. I have the .exe, but when I run it, the window just closes itself. In the cmd window from which I compiled the script from, It says some dlls are needed. What does this this have to do with it, and more importantly, is … | |
I have a source code that opens a csv file and sets up a header to value association. The source code is given below: def ParseCsvFile(source): """Parse the csv file. Args: source: file to be parsed. Returns: the list of dictionary entities; each dictionary contains attribute to value mapping or … | |
I want to know if there is anyway I can make an email alert with a balloon popup in the system tray, so far starting with I have made a system tray icon using pyqt that seemed to be simple enough, but I am not finding any starting point for … | |
How do i implement levenshtein disance on records in a database table using python? I know how to connect python with database, coding in python may not be problem, and I also have the records in a database table. The problem is how do i make it work. Below is … | |
Hey guys, I've been trying to create a simple calculator interface in Python, with a display, a set of buttons which can input the digits 0-9, buttons for addition and subtraction, a button to clear the display, and an equals button. Code so far: from tkinter import * import tkinter.messagebox … | |
Hello Guys I am trying to make a game with Tkinter. It involves selecting different options from a set of buttons. I created a root for the window, and am done with all the basic game programming. Its a football league simulator allowing players to select a team and choose … | |
I have run py2exe sucessfully up to this point using cmd (python setup.py py2exe). My Error is ImportError: DLL load failed: %1 is not a valid Win32 application I am leaving for spain tomorrow and would like an answer fast! |
The End.