15,181 Topics
| |
I'm a Python noob trying to make a program where the user will enter as many integers as they want and have the program calculate the total sum. They have to type the word "done" to execute the sum calculation. When I ran my program, I tped in 'done' and … | |
This is **Python** language. Hello, I'm trying to make a program where the user enters his/her initials followed by a block of text. After that, the program will print out the number of times his/her initials showed up in the block of text. For example, if my initials are VKL, … | |
How would i make python read a text file and find something then read a certian number of lines below it i.e if you had: card 1: ball red it need to find card 1:, then it needs to read the line below (ball) and set it to a string … | |
Hello, I'm a starter in Python and I need help. I'm trying to ask the user to input as much text as he/she likes until he/she types EOF (end of file) on a separate line. Once he/she does, the program should end. I started on my code and below is … | |
How can write these fuctions differently ? def computeVoltages(Vs, TC, tValues): return [Vs * (1 - e ** (-t / TC)) for t in tValues] def computeTimeValues(TC, intervals): time = [] width = 5 * TC / intervals for i in range(intervals + 1): time.append(i * width) return time | |
I have a program that takes csv values, parses the content and inserts it in an sqlite3 database. I am using sqlite3 to save on space and to make the py scripts a little more portable. The next refactoring may well need to have postgresql or mysql to deal with … | |
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 … |
The End.