14,951 Topics

Member Avatar for
Member Avatar for DragonSlayerX

[CODE]class Triangle: def __init__(self,x,y,z): self.x = x self.y = y self.z = z def perimeter(self): return self.x + self.y + self.z def area(self): ang = acos(self.y^2 - self.x^2 - self.z^2 / -2 * self.x * self.z) h = sin(ang) * self.x return self.z * h / 2 triangle = Triangle(input("Please …

Member Avatar for Gribouillis
0
124
Member Avatar for Bosterk

Hello, colleagues, Greetings I'm developing this code but I have problems on the part of a database query look at the full function code in which I have problems other than data base is [CODE]import sqlite3 as lite con = lite.connect('MiBase.sqlite') c = con.cursor() c.execute("""create table inventario (codigo real, producto …

Member Avatar for Bosterk
0
168
Member Avatar for Gribouillis

This snippet defines a context [icode]autofilename()[/icode] to create an existing temporary file with a new name in python. Unlike the methods in the [icode]tempfile[/icode] module, it only gives a filename which exists within a 'with' block, instead of an open file. This is useful for example when a program needs …

Member Avatar for Gribouillis
1
288
Member Avatar for M.S.

Hi All When trying to open a URL with bellow code, it Gives "TypeError: not all arguments converted during string formatting" [CODE=python]import urllib City="%D9%85%D9%87%D8%B1%D8%A7%D9%86" Province="%D8%A7%DB%8C%D9%84%D8%A7%D9%85" myurl = 'http://www.owghat.com/owghat.png.aspx?Province='+'%s'+'&City='+'%s'%(Province, City) #the real address is:http://www.owghat.com/owghat.png.aspx?Province=%D8%A7%DB%8C%D9%84%D8%A7%D9%85&City=%D9%85%D9%87%D8%B1%D8%A7%D9%86 a="e:\\img.png" urllib.urlretrieve(myurl,a)[/CODE] So, what I'm doing wrong? AND Another question: How to encode a utf-8 string(example: مهران) …

Member Avatar for M.S.
0
163
Member Avatar for lrh9

I'm interested in a generic event system for Python. I've searched the forum for similar topics, and I've searched the web for existing implementations. I haven't found exactly what I'm looking for. I'm familiar with the Observer pattern. However, my implementation and other implementations lack strong support for concurrency and …

Member Avatar for lrh9
0
112
Member Avatar for Archenemie

I have been looking for tutorials for about an hour now for pythin networking and nothing i am finding is helpful. What i need is a python program that will take a computers ip adress and tell me if a specific port is open. Can anyone give me a quick, …

Member Avatar for Tech B
0
272
Member Avatar for TrustyTony

Here is Mandelbrot set viewer in Tkinter and modules for shedskining (included compiled modules for windows in the zip file): [CODE]# mandelsh.py def mandel(real, imag, max_iterations=20): '''determines if a point is in the Mandelbrot set based on deciding if, after a maximum allowed number of iterations, the absolute value of …

Member Avatar for TrustyTony
0
1K
Member Avatar for vaironl

Hello, I'm a student in a summer workshop and i'm trying to make a python table from which people can choose the type , and within a mile radius. It's suppose to be compatible with an Arcgis map. If anyone knows how to make something similar please tell me how …

Member Avatar for vaironl
0
317
Member Avatar for rhuffman8

I am working in an older version of Python (2.6, I believe). I cannot update to the latest version because it is not currently compatible with the other program I need the code to run with so, unfortunately, the "decimal" module is not available to me (as far as I …

Member Avatar for Gribouillis
0
236
Member Avatar for Cesiumlifeboat

Hello python gurus! I dabble in python casually, and I've just recently begun to use classes. For the most part they've proven very helpful, but this error has me stumped: [CODE]creature.health=creature.health-2*creature.metabolsim/resolution AttributeError: predator instance has no attribute 'metabolsim'[/CODE] Here's the full code of the program (it's designed to run a …

Member Avatar for Gribouillis
0
164
Member Avatar for Joeflims

Hello, kind citizens of DaniWeb! I beg your assistance in the solution of my problem! I was trying to create a simple audio player using Tkinter and pygame, pygame being the best library that included audio playback I could find (by the way, DO NOT USE SNACK!!). Anyway, I was …

Member Avatar for Joeflims
0
179
Member Avatar for rhuffman8

I am working with a CSV file with multiple rows, which I need to be able to access individual data elements from a row so I can assign them to variables and send them to the other program I am working with in a loop, going through each individual row. …

Member Avatar for rhuffman8
0
355
Member Avatar for D33wakar

I'm trying to embed python script in c in windows. [CODE] #include <Python.h> int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString("from time import time,ctime\n" "print 'Today is',ctime(time())\n"); Py_Finalize(); return 0; } [/CODE] from the python documentation. I'm compiling with Microsoft's lcc. I'm getting following errors. Error c:\lcc\examples\python\pyembed.c 7 undefined reference …

Member Avatar for D33wakar
0
390
Member Avatar for bmanzana

this prints all five iterations. cani make it only print the last iteration? [CODE]key1 = [' ','a','b','c','0','1','2','3'] out = '' inpt = raw_input('enter text:') for i in inpt: if i in key1: out = out + key1[key1.index(i)+3] print out[/CODE]

Member Avatar for bmanzana
0
105
Member Avatar for sdwinanta

I am newbie in Python and given a task from my boss to do this : 1. Grab streaming(real time) data from twitter using PyCurl connection and output in JSON 2. Parsing using NLTK and Regular Expression 3. Save it to database file(MySQL) Note : i took the data from …

Member Avatar for TrustyTony
0
153
Member Avatar for Charly-Garcia

Hi any idea of how to parse a file like this. The problem that I found reading a line a putting into a list that it does not respect the blanks, I need to parse first 9 positions, then 8 positions then 8 positions, then 7, then 7 then 7 …

Member Avatar for Gribouillis
0
144
Member Avatar for liran

Hello I need to rename a folder within / inside a ZIP file, preferably without extract it and compress it off-course. How can I do this (only with free help stuff if needed) ? Thanks

Member Avatar for liran
0
155
Member Avatar for aot

I'm frustrated by the nature of time.sleep(), which prevents the script from doing anything else during the allotted time period. For example, I have: [CODE]while True: checkSomething() time.sleep(0.1) print 'hello'[/CODE] In this case, "hello" is never printed. I really want to check something every few milliseconds, but I also need …

Member Avatar for txfoo
0
1K
Member Avatar for felix001

Ive written a small program to convert celcuis o Fahrenheit and vice versa. The script as it stands works : [CODE]#!/usr/bin/python import sys def convert(t,fc): if t == "c": print (fc * 9) / 5 + 32,"Degress Fahrenheit" elif t == "f": print (fc - 32) / 9 * 5,"Degress …

Member Avatar for Gribouillis
0
185
Member Avatar for zy_430l

i searched the internet and found no scripts for dynamic text (user input, process and output) for blender game engine. id appreciate any help. i can only make the user type in the game but could not get it to be saved in a global variable which i will use …

0
65
Member Avatar for Bosterk

Hi, I'm new to Python, I'm practicing queries sqlite3 database, I will present what I have so far. until now I have not seen an example of how to reflect queries a database using wxPython I hope I help, do not write very good English. frame.py import wx import sqlite3 …

Member Avatar for Gribouillis
0
298
Member Avatar for zentechsupport

I am just learning python. I am switching from visual basic so this is a bit new to me. I am trying to write a loop for a super small script. It is below I am trying to understand the def f() how to loop that short code over and …

Member Avatar for woooee
0
233
Member Avatar for wilfanada

[B][LIST=1] [*]it's very exciting to be alive in this age of technological revolution and deep spiritual awakening. for me, to be fulfilled means to be fully engaged expanding your knowledge and wisdom and giving back to the society while you remain happy and true to your mission. i would like …

Member Avatar for suraj_p
0
212
Member Avatar for the1last

I have two text files containing multiple lines of text from a datalogger, and I need to compare the two files and save the difference into a third text file. ie.... text1: 10/13/01, 21:34:23, 4324 10/14/01, 09:12:32, 3423 10/15/01, 04:45:54, 7834 text2: 10/12/01, 43:34:34, 6453 10/13/01, 21:34:23, 4324 10/14/01, 09:12:32, …

Member Avatar for radk
0
16K
Member Avatar for wilfanada

for the past ten years i have tried without much success to program in c, c++, java and c# .net. my major problem has been inconsistency and lack of focus and direction. now, i want to start all over again with Python as my language of choice. what must i …

Member Avatar for Killer_Typo
0
142
Member Avatar for Simplicity.

Hi all, I'm running a python program that takes to long to run - several days on a normal machine. To make things faster, I have decided to use a cluster of giant computers to run this code. Does anyone know how to use Message Passing Interface (MPI) in python …

Member Avatar for TrustyTony
0
75
Member Avatar for Killer_Typo

Trying to build a simple python script on my mac, but the mac is 64 bit and apparently does not want to play nice. Does anyone know of any workarounds or if I am missing something? command i am running is python setup.py py2app -A output is: error: argv-emulation is …

Member Avatar for Killer_Typo
0
263
Member Avatar for theharshest

Hi Friends, I want to learn web application development. I have good experience in C programming language and no other language. Can you please suggest me where to start with? I have already dived into Python a bit, so I searched the net for some good framework and got Django. …

Member Avatar for griswolf
0
308
Member Avatar for Pprog

Hi, I have a thousands of IP addresses, repeating randomly in my database and I wish to print each IP address along with the number of times they are repeated. For example, 162.10.2.1 162.10.2.1 162.10.2.1 192.34.1.10 172.11.2.9 192.34.1.10 192.34.1.10 Output: 162.10.2.1 - 3 192.34.1.10 - 3 172.11.2.9 - 1 I …

Member Avatar for Gribouillis
0
2K
Member Avatar for M.S.

Hi All Please some one Help me find out why this code doesn't work: [code=python]codes=['zlib', 'zip', 'base64', 'hex', 'utf-8'] def encoder(str, i): return str.encode(codes[i]) def decoder(str, i): return str.decode(codes[i]) en = encoder('Some string here', 2) print en[/code]

Member Avatar for M.S.
0
107

The End.