15,175 Topics
| |
Hi all, I'm quite new to Python (and programming in general) and I'm a bit confused about how to implement inheritance in an assignment I'm doing at the moment. The basic gist is: we're supposed to make a program that can record stock items for a company. We're to make … | |
I am running canopy 64 bit Version: 1.0.3.1262 on mac Mountain Lion. I have installed virtualenv using easy_install. But while I am trying to execute the command: virtualenv venv --distribute It shows the following error: Using base prefix '/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents' New python executable in venv/bin/python dyld: Library not loaded: @rpath/Python Referenced … | |
I'm a beginner in phyton. i'm just starting to read things about phyton because we need it for our project. I really need basic and detailed instructions on how to use it and use it using notepad++. Could someone help me? or teach me? ill also do my part and … | |
so I need to be able to open a text file, and when a button is pressed it searches for a tag in the file such as <l1> and anything after that tag would be put into a label. how would I go about doing this? | |
code: #I meant memory card import pygame, sys,random from functools import partial def image(x=50,y=100,default=True,nondefault_color=(0,0,0)): if default: color = hiddencolor else: color = nondefault_color print color image = pygame.Surface((x,y)) image.fill(color) pygame.draw.lines(image, [0,0,0],False, [(0,0),(0,100),(50,100),(50,0),(0,0)], 1) rect = image.get_rect() return image def card(pos): x= pos[0]/50 #integer divison y= pos[1]/100 if (x,y) in flashcards: … | |
I'm trying to make a short program where the user enters as many integers as they want. When they type 'done,' the program will calculate all of the numbers the user entered. So far when I run this program, all I get is "done." Am I close to being finished? … | |
I am looking for someone who can teach me how to segment a video file into chunks. Will appreciate it greatly if anyone decides to help me! | |
How to make initials-counter program? Hello, I'm trying to make a program that asks for the user's initials (3 letters) and a block of text, and then reports how many times their initials showed up in the block of text. For example, if my intials are VKL, and I type … | |
the input is [120, [10, 20, 30]] i split the balance using this code def checkio(data): balance=[int(x) for x in data[0:1]] withdrawal=data[1:2] but when i split it the withdrawal section looks like [[10,20,30]] which hinders the loops im going to do. I want it to have single brackets like so: … | |
Weak refrences to an object can be collected if no strong refrences remain, but we can disable it! Lists and dictionaries cannot be weak refrenced, but this can: class Dict(dict): pass class List(list): pass If your holding a large dictionary, you might want to split up over diffrent variables, like … | |
I need help writing a program that will read a string from the user and print the string with every other word removed. Ex. Input sentence: Hello everybody Eloeeyoy | |
I stumbled on upon this anomaly in one of my programs and can't figure out why this is happening. I made a small test function that exhibits the same behavoir. It's like the local variables of my function are being saved after the function exits. The exclude_ids variable keeps growing. … | |
Hello I want to make a GUI tool in python Tkinter that can check if the site is up or down, I did a quick search on google and i came up with the following code import httplib conn = httplib.HTTPConnection("www.google.com") conn.request("HEAD", "/") r1 = conn.getresponse() print r1.status, r1.reason I'm … | |
notdone = [tuple((x,y))for x in range(5) for y in range(6)] for i in showns: s = lambda :tuple(random.sample(notdone,1)) #random.sample gives a LIST even though I used tuple() print notdone #debug a = s() print a #debug notdone.remove(a) b = s() flashcards[a] = Flashcard((x*20,y*100),i) flashcards[b] = Flashcard((x*20,y*100),i) [(0, 0), (0, 1), … | |
Hi, I'm wondering if anybody knows of a python compiler to make an exe with. I have tries cx_freeze and py2exe so far, but I haven't been able to get it to work. If anyone has any good python to exe compilers please post here. Thanks, 26bm | |
import os segmentbytes = 5242880 fullbytes = os.path.getsize("Wildlife.wmv") numframe = fullbytes / segmentbytes remainder = fullbytes % segmentbytes parts = [open("Wildlife_Part%i.wmv" %i ,'wb') for i in range(numframe)] with open("Wildlife.wmv",'rb') as f: segment = f.read(segmentbytes) for j in range(numframe): parts[j].write(segment) f = open("Segment.txt", "wb") for i in range(numframe): f.write("Wildlife_Part%i.wmv" %i + … | |
Sorry for the complete newbie question, and apologies in advance if this isn't the right place to post this, but I'm trying to revamp my portfolio site and have been pulling my hair out for 3 days trying to get Jinja 2 templates to work. I originally designed my site … | |
This code isn't working and is just returning "Is a Palindrome", I believe it is a slicing problem of sorts. Please help! #!/usr/bin/env python x = input("Enter here: ") x is x[:-1] if True: print ("Is a Palindrome") else: print ("Is Not a Palindrome") | |
can anyone please tell me the difference between a process and a service? | |
I have included the entire source. I am getting the traceback error. import os import sys import fileinput import datetime from time import localtime name = sys.argv[1] # log specifies the file that is supposed to be parsed by the script log = fileinput.input('/var/log/secure.log') L = localtime() CalendarMonth = L[1] … | |
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 |
The End.