15,190 Topics

Member Avatar for
Member Avatar for as3g

I know how to write to an existing txt file via Py function, but can you create the file itself from the function, or MUST the txt file already exist?

Member Avatar for as3g
0
94
Member Avatar for mark_31

Hi all, I'm not a Python expert (I've only dabbled a little). A user has asked me to help with a short webcrawling script they have written. They are making use of Dale Hunscher's UrlNet library in the script. They basically want to have the script ignore overly repetitive URLS …

Member Avatar for joehms22
0
311
Member Avatar for bigredaltoid

Hi guys, trying to write a function that reads a text file and counts the periods in it and prints the answer. I keep getting an error saying that UnboundLocalError: local variable 'periods' referenced before assignment. I am not sure how to fix this. We must use a function to …

Member Avatar for bigredaltoid
0
137
Member Avatar for spunkywacko

Hey guys. I'm having some trouble with this error. [CODE] class App(): i = 0 def updateCount(self): i = i +1 app = App() app.updateCount() input('Enter') [/CODE] I have tried global i but get an error 'global name i is not defined'. Can someone clue me in? Cheers :D

Member Avatar for Gribouillis
0
203
Member Avatar for as3g

I'm new to python and I'm trying to count punctuation in a string input by user, and I"ve been able to do it w/ out a loop, but would like to emply a more efficiant method. I've been able to loop through and grabb the characters, but they are'nt being …

Member Avatar for as3g
0
167
Member Avatar for Dann0

Hey guys, hope I'm in the right section here, I presume Pygame falls under python. I'm trying to make a circle move left,right,up or down depending on the users input (e.g if the user presses the "a" key then the circle will move left by itself, rebound off the edge …

Member Avatar for Dann0
0
195
Member Avatar for poker158149

Hey there, everyone. My friend and I are looking into writing a very simple game in Python. We're gonna use PyGame for it as well. It's a top-down view 2D game where you play as a guy with an ax who kills zombies. There are not different levels; it's all …

Member Avatar for Greeky
0
160
Member Avatar for strongguy12345

ok well this is my first thread that im asking 2 questions, im new here, these are from my high school college computer science class, one is newer and one is older, i went back to the older one because I still want to finish it and try and extend …

Member Avatar for woooee
0
191
Member Avatar for Lomholdt

So im making a anagram detector that reads all the words in a string. I already have the anagram funktion working (returning true if it is a anagram, and false otherwise) But i am having trouble making a loop that reads all the words in the string, and returning the …

Member Avatar for Lomholdt
0
155
Member Avatar for RoqueyB

I am supposed to have a while loop that asks for a number until the number is a negative. Then I am supposed to get a total of all of the numbers EXCEPT the negative number. As of right now my program adds up the absolute value of all the …

Member Avatar for TrustyTony
0
154
Member Avatar for TrustyTony

Here is class that can be fed directly from split stream like one number per line file (or [URL="http://www.daniweb.com/software-development/python/code/321725"]generator producing 'words'[/URL] from multiple numbers per line).

Member Avatar for Gribouillis
0
608
Member Avatar for Joey7

Hello All, I'm working on my first Python plot in my programming class this week. My assignment is to write a program to plot data contained in a csv format. Here is the data: "Bowl number", "Date", "Bowl location", "Winner", "Number wings eaten" "I", "1/29/1993", "Wyndham Franklin Plaza Hotel", "Carmen …

0
163
Member Avatar for Acidz

Hi, I'm new here... Please help me fix it, if I posted at the wrong section, this is about Python but also game development... So I'm not sure? :) anyway: I need some guide lines to the way of coding? or the use of things within the code... Here I …

Member Avatar for lrh9
0
271
Member Avatar for Tech B

There isn't a whole lot here about security related stuff, so I figured I would post some work in progress. It is pretty well commented so following it should be pretty simple. The full story and reasons for doing what I did, and not another way can be found on …

Member Avatar for TrustyTony
1
374
Member Avatar for Sinnocence

I compiled with py2exe and added the setup.py script because a few people have been having trouble with email.MEME.Text working with py2exe. The .PNG's are attached below save them to your c:/python26/ there isn't much security (passwords are temp stored in a .dat file) ________________________________________________ to: [email]john@email.com[/email] sendcount = 100 …

0
93
Member Avatar for lordluke_80

hi everyone. hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, …

0
202
Member Avatar for python-noob

I am relatively new to python and am having a hard time with an assignment. We just started using dictionaries and I can't quite grasp what is going on. I am just having trouble figuring out where to even start exactly. This is the code my teacher gave me and …

Member Avatar for TrustyTony
0
2K
Member Avatar for pelin

the question is a year is a leap if it is divisible by 4, unless it is a century year that is not devisible by 400. write a program that calculates whether a year is a leap or not [CODE][/CODE] def main(): year = eval(input("Enter a year")) if year/4 and …

Member Avatar for pelin
0
119
Member Avatar for mjohnson

I need to write censor program that 1-reads in the text from a file 2-creates a new file where all the four-letter words have been replaced by “****”. can you help? this what I have so far [CODE]import string def main(): filename = raw_input("File: ") text = open(filename,'r').read() text = …

Member Avatar for mjohnson
0
492
Member Avatar for sofia85

I'm a beginner at python programming and now I want to try to write a function consisting of my already written programs. The goal is to get all probabilities when I'm calling on the function in the main program. My already separately written programs looks something likes this and the …

Member Avatar for Gribouillis
0
192
Member Avatar for fatalaccidents

Hey guys, This is a quick formatting question that I'm having trouble with. I'm trying to create columns of numbers, but I want the columns to only be as large as the largest number in that column. I was trying to use format() width, but that is creating a width …

Member Avatar for fatalaccidents
0
169
Member Avatar for bigredaltoid

Hi guys, first off just wanted to say that this website has been immensely helpful to me for my programming class. I asked a question to help with a lab a couple of weeks ago and was able to figure out the issue with the forums help, so thank you. …

Member Avatar for TrustyTony
0
2K
Member Avatar for Ice_Occultism

Hey, I'm on the rookie side, to Python, and Pygame and new to this community, and I'm confused if this could be possible; I want to change the data type of a list, in Python, from strings to integer (they have to be integer, because I need to sort them …

Member Avatar for Ice_Occultism
0
371
Member Avatar for ChristianOncken

[code] # -*- coding: utf-8 -*- #diretorios de imagens alldir = ("C:\\Users\juridico.anoreg\Desktop\OFICIOS-ANOREG\imagem\\") # from tkinter import * from tkinter.filedialog import * import sys import tkinter import time import math import datetime import os import subprocess import tkinter.messagebox import calendar as cd from tkinter import * import webbrowser import tkinter.font class …

Member Avatar for ChristianOncken
0
319
Member Avatar for abhik1368

I have a sort of csv file which looks likes given below i want to count number of digits in each line like number of 0's ,1 s in each line and print them this way for each line i want to print information in csv file . 0 0 …

Member Avatar for Gribouillis
0
136
Member Avatar for Cyl11

I want to write a simple program for burning calories, but I haven't used python in so long I could use some aid. The basic formula is this =0.0201*EXP(0.107*G3)*71*(F3*24*60) Where: 71 is my weight in kg G3 is speed in MPH F3 is time in days I'm not sure if …

Member Avatar for TrustyTony
0
87
Member Avatar for DarkFeather

I just recently started using Python and I was wondering if there was a way to increase a value in a list.

Member Avatar for DarkFeather
0
44
Member Avatar for Sprewell184

Hi there. For some reason I am struggling with this problem. The purpose of this problem is to take an existing .py file and change it so instead of writing to a screen, it has to be written to an output file. The output file will be a csv file. …

Member Avatar for snippsat
0
277
Member Avatar for pelin

HOW CAN I WRITE A PROGRAM THAT CALCULATES THE FIRST N NATURAL NUMBERS THAT USER ENTERS. I SHOULD USE FUNCTIONS. n = eval(input("Enter the value of n: ")) def sumN(n): for i in range(n): sum = n+i return sum sum = sumN(n) THIS IS WHAT I DID SO FAR. THANKSSS

Member Avatar for pelin
-1
135
Member Avatar for felix001

What is the best way to print columns within python. Each of the values that I will be printing will be anything from 1 to 8 characters long. I had found this but wondered if there was any other methods... [url]http://www.daniweb.com/software-development/python/threads/202023[/url] Thanks,

Member Avatar for felix001
0
324

The End.