15,185 Topics
| |
I want to create sqlite3 databases from within a python script. I am currently running this code which does not pass the right variable content to the sqlite3 command prompt, so I have one issue there. I also do not want to have the user have an sqlite3 command shell … | |
I'm working on a script that needs to use the Github API to allow the user to gain access to their Github account. I'm still really new to web programming, so I'm not really comfortable with how to securely transmit username and password combinations. I'm just wondering what are some … | |
Hi I have script(ip.py) that send me ip.txt from my remote pc to my email. My problem is my firewall in my remote pc block ip.txt file. How can I tell Firewall in my script to allow ip.txt file from my remote pc(Add python script to firewall exceptions)? I’m using … | |
Hi, I am wondering if there is a way to somehow look at the contents of a variable and make a variable name with the contents of that variable. I really don't know how else to word that, just wondering. If anyone understands what I am saying and knows an … | |
I use: Python 2.6 and sqlalchemy 0.6.1 This is what I am trying to do: from sqlalchemy.types import ( Integer, String, Boolean ) from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class SampleMeta(type): def __new__(cls, name, bases, attrs): attrs.update({ 'id': Column('Id', Integer, primary_key=True), 'name': Column('Name', String), 'description': Column('Description', String), 'is_active': Column('IsActive', … | |
How do I go about writing a python application for windows mobile 6.1 or 6.5? I need to write one application (simple application, except for need for SQL support) for Windows Mobile. I been trying to decide which language is better to use. At first I tried to install Windows … | |
Hi all. I'm wondering if it is possible to pass formatted strings to function arguments. I'm doing something like this: `OUT_TASK = "Task_{id1}, FUNCTION, {id2}, task{id3}_types, None"` `t = Task(OUT_TASK.format(id1=i, id2='doNothing', id3=i))` Any clues are much appreciated. Any other means for doing variable arguments are of interest. | |
import serial import threading import Queue import Tkinter as tk class SerialThread(threading.Thread): def __init__(self, queue): threading.Thread.__init__(self) self.queue = queue def run(self): s = serial.Serial('COM10',9600) while True: if s.inWaiting(): text = s.readline(s.inWaiting()) self.queue.put(text) class App(tk.Tk): def __init__(self): tk.Tk.__init__(self) self.geometry("1360x750") frameLabel = tk.Frame(self, padx=40, pady =40) self.text = tk.Text(frameLabel, wrap='word', font='TimesNewRoman 37', … | |
Hey guys is there a funtion in python that enables to output values to a bin files? Just like storing strings in .txt files, can we store hexadecimal values directly into .bin files? I am working using Python 2.7.3 | |
hi, Please can anybody help me with this problem, i am creating an application that outputs to a notepad file on windows 7, i would like to know if there is a python module that i can use to invoke a notepad file(example trial.txt) to output into.THanks | |
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 … | |
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 … | |
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 | |
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! … | |
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 … | |
In a combat system, how would I have a certain raw_input repeat until the enemy is dead? | |
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 … | |
Is there a way to keep a global throughout multiple def statements? | |
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 … | |
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: … | |
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? | |
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 … | |
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 … | |
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 | |
When I run: [code]dec = 255 print hex(dec) [/code]I get 0xff, but I like to get just 'ff' | |
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 … | |
| 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 … |
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. | |
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? | |
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+',' … |
The End.