15,175 Topics

Member Avatar for
Member Avatar for Pallab.Bhk

Hey I have dictionary like following one dicts = {'met_293': ['81.0175','4','7','7','29.76','23','1','0','22','28.57','2','[KG]EHY'],'met_394': ['79.9579','4','7','7','29.76','18','3','0','15','28.57','2','EHY[ILV]'],'met_309': ['81.0175','4','7','7','29.76','23','1','0','22','28.57','2','[KG]EHY'],'met_387': ['79.9579','4','7','7','29.76','18','3','0','15','28.57','2','EHY[ILV]']} I want to remove keys which have same value like 'met_293' and 'met_309' those two keys have same value at 12th position which is '[KG]EHY' so i want my dictionary like this {'met_293': ['81.0175','4','7','7','29.76','23','1','0','22','28.57','2','[KG]EHY'],'met_394': ['79.9579','4','7','7','29.76','18','3','0','15','28.57','2','EHY[ILV]']} any …

Member Avatar for Pallab.Bhk
0
485
Member Avatar for Benkku

I was trying to calculate the angle between two points using math.atan2(y, x) as was suggested in numerous forums and tutorials. After trying it myself, it didn't quite work as charmingly as it did for others. So I made a simple example of what it does and I need some …

Member Avatar for Gribouillis
0
426
Member Avatar for Matigo

Hello everyone How can i make the button be on the left side or right side please Part of the code Button(self, text = "start", command = self.launch).grid(row = 7, column = 0, columnspan = 1,) Thanks in advance

Member Avatar for bumsfeld
0
217
Member Avatar for Jacklittle01

I am trying to make a system for my game in which the player's enemy has a decreasing amount of health. My shell output is here: Cannon Fired! Enemy Health= 8 Cannon 1 ammo = 10 The enemy fired back! Your health is now 12 Fire your choice of cannon! …

Member Avatar for Jacklittle01
0
148
Member Avatar for Jacklittle01

In my game, I am trying to make it so when the enemy's health equals 0, the player advances. I used a while statement and a true or false variable. When the enemy health is less than or equal to 0, the program exits the while statement. It does not …

Member Avatar for sepp2k
0
117
Member Avatar for Jacklittle01

In a combat system, how would I have a certain raw_input repeat until the enemy is dead?

Member Avatar for sepp2k
0
81
Member Avatar for Matigo

Hello everyone I'm building my first app using Python TkInter and i would like to have someone help me with this I want to make a checkbox by default it should be False (Unchecked) And make it do something like (Sorry i only know how to do it on visual …

0
95
Member Avatar for Jacklittle01
Member Avatar for slate
0
283
Member Avatar for bilashcse

I need some help for python AI. I can't understand some codes for python AI. I need to understand this code. So please help me. code : def __str__(self): if self.nature is 'AI': return self.name+' ('+self.nature+')'+' as '+self.colour else: return self.name+' as '+self.colour In this code 'AI' is used. But …

Member Avatar for m_ishwar
0
167
Member Avatar for theholychilli

I am creating a pokemon text-based game. I have 1 problem, I dont know how to do the attacks. I thought - enemyHP = 100 class pikachu: def slamAttack(self): self.enemyHP = enemyHP - 30 print("pikachu used slam!") print(enemyHP) #then to call it when they ask for slam attack = str(input("OPTIONS: …

Member Avatar for m_ishwar
0
608
Member Avatar for john.rickley

Hey, I m writting this python program and I need to have the user enter a password. As with all passwords, if it is correct then the program proceeds. if not, then it halts there. What code should I use for this?

Member Avatar for slate
0
179
Member Avatar for goutham.tandra

i don't know anything about django.. but i want like google while we are searching data in one tab and if we open new tab we getting new search page... am doing one task in my office but if i open new pageam getting last saved values.. so please help …

0
74
Member Avatar for natehome

im trying to get this script to draw a line from the center of the rectangle to the mouse BUT i only want it to draw about 10 pixels out. how can i find that point that is 10 pixels(or points) out? code so far: import pygame from pygame.locals import …

Member Avatar for natehome
0
303
Member Avatar for andrew.makkink

My opensuse 12.came with python 2.72 installed. How can I update that and two, which editor would be reccomended? Thanks but please this is my first attempt at linux

Member Avatar for andrew.makkink
0
130
Member Avatar for Lardmeister

When I run: [code]dec = 255 print hex(dec) [/code]I get 0xff, but I like to get just 'ff'

Member Avatar for bumsfeld
0
5K
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
458
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
154
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
315
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
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

The End.