15,181 Topics

Member Avatar for
Member Avatar for wolf29

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 …

Member Avatar for wolf29
0
3K
Member Avatar for farhaana.ahmed.58

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

Member Avatar for slate
0
4K
Member Avatar for mini programmer

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 …

Member Avatar for mini programmer
0
1K
Member Avatar for debasishgang7

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 …

Member Avatar for debasishgang7
0
255
Member Avatar for G_S

Hy, I have a beginner question: when using PyDev should all my programs be inside a package or not?

Member Avatar for G_S
0
117
Member Avatar for tony75

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 …

Member Avatar for tony75
0
7K
Member Avatar for krystosan

I recently got a new macbook pro, can anyone suggest me a really good free python IDE i can use on OS x ?

Member Avatar for krystosan
0
341
Member Avatar for G_S

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 …

Member Avatar for G_S
0
304
Member Avatar for degarb

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 …

Member Avatar for bumsfeld
0
253
Member Avatar for krystosan
Member Avatar for m_ishwar

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 …

0
378
Member Avatar for tony75

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 …

Member Avatar for woooee
0
290
Member Avatar for tunisia

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 …

0
130
Member Avatar for Yongsmith

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 …

Member Avatar for Lucaci Andrew
0
177
Member Avatar for m_ishwar

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 …

Member Avatar for m_ishwar
0
164
Member Avatar for felix001

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

Member Avatar for chriswelborn
0
195
Member Avatar for ArsenalTengu

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

Member Avatar for ArsenalTengu
0
223
Member Avatar for floatingshed

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 …

Member Avatar for woooee
0
465
Member Avatar for Jacklittle01

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!

Member Avatar for tony75
0
248
Member Avatar for Jacklittle01

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 …

Member Avatar for tony75
0
166
Member Avatar for krystosan

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 …

Member Avatar for chriswelborn
0
525
Member Avatar for krystosan

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 …

Member Avatar for chriswelborn
0
178
Member Avatar for Tiger1

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 …

Member Avatar for Lucaci Andrew
0
163
Member Avatar for edward.miller.921

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 …

Member Avatar for edward.miller.921
0
851
Member Avatar for m_ishwar

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 …

Member Avatar for Schol-R-LEA
0
219
Member Avatar for Jacklittle01

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!

Member Avatar for snippsat
0
70
Member Avatar for tony75

Hi Anyone know why this program not work?I wonder if I use right usage? import os import optparse import mechanize import urllib import re import urlparse from _winreg import * def val2addr(val): addr = '' for ch in val: addr += '%02x ' % ord(ch) addr = addr.strip(' ').replace(' ', …

Member Avatar for kwheeles
0
242
Member Avatar for Jacklittle01
Member Avatar for JeoSaurus
0
138
Member Avatar for Jacklittle01

Can one turn a python file into a standalone executable for windows via a gui program? Thanks

Member Avatar for vegaseat
0
368
Member Avatar for otengkwaku

Hi guys, i am working on a project the need me to convert a compressed obj file using webgl utf-8 compresor [webgl-loader](https://code.google.com/p/webgl-loader/) back to it acsii version. I will like someone to point me in the rigth direction. i am comfused as to how to do the decompression

Member Avatar for LastMitch
0
267

The End.