15,190 Topics

Member Avatar for
Member Avatar for happygeek

There are precious few archaeologists in Japan, and only a handful who produce their own software programs to analyze geographic information. One who does is Professor [Izumi Niiro](http://www.okayama-u.ac.jp/user/arch/about/niiro.html) of the Okayama University. A convert from Perl, Professor Niiro now uses Python to perform data analysis via the Geographic Resources Analysis …

1
464
Member Avatar for No_idea

hi, I want to load an unknown number of buttons (20 max) into a panel. When clicking a button, some other code should be executed. Below code shows my attempt at solving the problem. Unfortunately execution results in an assertion error. Any help in pointing me in the right direction …

Member Avatar for No_idea
0
228
Member Avatar for shahinalam07

Given: A string s of length at most 200 letters and four integers a, b, c and d. Return: The slice of this string from indices a through b and c through d (with space in between), inclusively.

Member Avatar for stbuchok
0
101
Member Avatar for m_ishwar

Guys! I would like to know if it was possible to create an assembler using python since it has excellent string handling features. Any Ideas how it could be done?

Member Avatar for m_ishwar
0
155
Member Avatar for farhaana.ahmed.58

i have a text document 'topics.txt': 1~cocoa 2~ 3~ 4~ 5~grain~wheat~corn~barley~oat~sorghum 6~veg-oil~linseed~lin-oil~soy-oil~sun-oil~soybean~oilseed~corn~sunseed~grain~sorghum~wheat 7~ 8~ 9~earn 10~acq and so on.. here the numbers correspond to the file names, i have about 20000 files. 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+',' …

Member Avatar for chriswelborn
0
247
Member Avatar for Jacklittle01

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.

Member Avatar for aVar++
0
102
Member Avatar for wolf29

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 …

Member Avatar for wolf29
0
319
Member Avatar for jpk1a873

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 …

Member Avatar for woooee
0
8K
Member Avatar for ibpet11

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.

0
65
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
118
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
350
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
305
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
255
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
388
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
291
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
196
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
466
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
249
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
546

The End.