15,181 Topics

Member Avatar for
Member Avatar for stealthless

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 …

Member Avatar for edward.okech.5
0
226
Member Avatar for stealthless

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, …

Member Avatar for edward.okech.5
0
250
Member Avatar for epicSHOOTER236

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 …

Member Avatar for epicSHOOTER236
0
279
Member Avatar for stealthless

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 …

Member Avatar for slate
0
542
Member Avatar for alienwave

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

Member Avatar for alienwave
0
144
Member Avatar for wolf29

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 …

0
175
Member Avatar for slamshuffle

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 …

Member Avatar for james.lu.75491856
0
185
Member Avatar for Mohammad_7

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 …

Member Avatar for slate
0
294
Member Avatar for red23

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 …

Member Avatar for JasonHippy
0
3K
Member Avatar for epicSHOOTER236

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?

Member Avatar for epicSHOOTER236
0
157
Member Avatar for james.lu.75491856

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: …

0
98
Member Avatar for stealthless

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? …

Member Avatar for slate
0
184
Member Avatar for pythonforlife

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!

Member Avatar for Gribouillis
0
280
Member Avatar for stealthless

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 …

Member Avatar for TrustyTony
0
246
Member Avatar for toniann.midori

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: …

Member Avatar for toniann.midori
0
3K
Member Avatar for james.lu.75491856

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 …

Member Avatar for james.lu.75491856
0
140
Member Avatar for Cducks

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

Member Avatar for snippsat
0
166
Member Avatar for ihatehippies

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. …

Member Avatar for james.lu.75491856
0
775
Member Avatar for Matigo

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 …

Member Avatar for james.lu.75491856
0
173
Member Avatar for james.lu.75491856

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), …

Member Avatar for james.lu.75491856
0
174
Member Avatar for 26bm

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

Member Avatar for james.lu.75491856
0
377
Member Avatar for pythonforlife

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 + …

Member Avatar for pythonforlife
0
131
Member Avatar for bwshields

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 …

0
74
Member Avatar for jude.caird

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")

Member Avatar for james.lu.75491856
0
169
Member Avatar for krystosan
Member Avatar for Gribouillis
0
74
Member Avatar for LincyDaniel

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] …

Member Avatar for james.lu.75491856
0
164
Member Avatar for wolf29

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 …

Member Avatar for james.lu.75491856
0
358
Member Avatar for BlackJavaBean

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 …

Member Avatar for gusano79
0
119
Member Avatar for tony75

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 …

0
80
Member Avatar for 26bm

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 …

Member Avatar for TrustyTony
0
255

The End.