15,190 Topics
![]() | |
Hi guys , Im new at pythons . Hope you all can help me out here : Im trying to write a code which prints the elements from every list as a line . so If my lists are : l1 = ['0000002', '0000003', '0000004', '0000005', '0000008', '0000009', '0000010'] l2 … | |
I am facing problem connecting problem connecting remote MySQL server which is firewall protected. I used the valid user name and password, but it throws me the error [I]OperationalError: (2003, "Can't connect to MySQL server on 'www.myreomtemysqlserver.com' (10061)")[/I] I want to connect from python. I searched in Google is there … | |
I am trying to make pygame draw a shape from a list of shapes imported with fileIO but i get a pygame import error please help [CODE]import random import pygame w = 640 h = 480 x = open("shapes.txt") z = x.readlines()[n] n = random.randrange(6) screen = pygame.display.set_mode((w, h)) pygame.draw.z(screen, … | |
Ok so if anyone can spare a few minutes and can tell me what each of these things are in terms of python (or plain english), that would be FANTASTIC! [code] (this is in a for loop where d is defined as 1-9) D = load(['digit' num2str(d) '.ascii'],'-ascii'); save(['digit' num2str(d) … | |
Correction: The subject line was supposed to have said BAR CHARTS, not bar codes. Rather than reinventing the wheel, I'd like to know if something already exists that will get going me in the right direction. I have a program that, among other things, ftp's files to multiple computers in … | |
Oh man, I'm sure you guys are going to have a good time making fun of my newbie self, so enjoy! I have output that looks like this: [' sum\n', '\n', '1257869640: 6.8744400000e-02\n', '1257869660: 6.8744400000e-02\n', '1257869680: 6.8634000000e-02\n', '1257869700: 6.9022750000e-02\n', '1257869720: 7.0189000000e-02\n', '1257869740: 7.0189000000e-02\n', '1257869760: 6.9119800000e-02\n', '1257869780: 6.8245000000e-02\n', '1257869800: 6.8245000000e-02\n', '1257869820: … | |
[CODE]#include <iostream> #include <sstream> #include <fstream> #include <string> #include "Python.h" using namespace std; #define tP PyRun_SimpleString(pyCom.c_str()) double func(double x); int main() { //file to write numbers to ofstream file; file.open("numCache.txt"); //string for int to string conversion string temp; stringstream output; //string that is read from console string numCache; //returned number … | |
I'm making a small game in which you can choose the amount of points needed for victory. You play until either cpu_point or player_point is equal to (or greater than) the rounds. You get one point per win. What I'm having trouble with is the while check. I'd like to … | |
Hey guys, I want to create a new array in python. But cant seem to find a way of doing it without having to give initializing values... Basically i want to do wat this java line does float myArr[65353]; and to make matters worse when storing/retrieving data i wont be … | |
hey guys, i have a problem.. i have this chunk of text like this..... [code] No. Time Source Destination Protocol Info 2 0.005318 192.168.110.33 192.168.110.44 ICMP Echo (ping) request Frame 2 (98 bytes on wire, 98 bytes captured) Ethernet II, Src: Cisco-Li_4d:e1:30 (00:1c:10:4d:e1:30), Dst: IntelCor_4d:77:83 (00:13:02:4d:77:83) Internet Protocol, Src: 192.168.110.33 … | |
hey guys, Got another question: in C programming etc we can stop an execution of say an infinite look by pressing Ctrl+C. What's the equivalent in python? i'm using the IDLE GUI. I've found myself in situations where its running a never ending long task which i want to stall, … | |
Hi, from below output I need to capture the DKC0 and DKA100 respectively to PKC0 and PKA0. Idea is if I pass PKA0 it should print DKA0 and if I pass PKA0 then it shd print DKA100. If I pass PKD0 and PKC0 it shd not print anything. SCSI Summary … | |
Can I pass a string filename as a parameter to a function? For example, [CODE]def func("something.txt"):[/CODE] When I do this, it says that the syntax is invalid. Is there a proper way to do it or it is simply not done? | |
I have a file like this: a,z,1 b,y c,x,1 d,w,1 e,v f,u What I need to do is to create a dictionary that has the characters in the first column as keys and characters in the third column as values. The rest should be ignored, i.e. {a:1, c:1, d:1}. This … | |
I am currently reading two books, one on PHP and one on Python. Not that I'M good at ether. I'M about half way through the book on PHP or less and almost done with the one on Python. Though I haven't actually read anything web related in this particular Python … | |
I'm just wondering what do I have to add to the code [code] print "Hello World" [/code] to output H e l l o W o r l d like there's spaces in between each letter? Thanks. | |
Hi I am running OS X 10.5 Leopard. It ships with Python 2.5.1 and I just installed Python 2.5.4 from python.org. The site-packages directory for 2.5.1 is located at /Library/Python/2.5/site-packages The 2.5.1 interpreter is located at /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 The 2.5.4 interpreter is located at /Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 The thing is that now that … | |
hi everyone. Just out of curiosity more than anything; does anyone know of a library that can grab microphone input (on windows)? I'm looking into how to write a kind of VoIP (voice ip) program. I know how to use sockets for sending/receiving data, but I just need the microphone … | |
Hello, Does python 3 have built in libraries that include support for the HTTP methods other than GET and POST? I couldn't find an answer to this looking through the urllib documentation on the python.org site or in numerous google searches. I am not a python expert by any stretch … | |
I've noticed there is at least 1 thread regarding to artificial intelligence. I assume most people new and old to python would be interested in artificial intelligence and the even greater goal of artificial life. I personally do not know anything about them. If you have ever had any experience … | |
Ok Here's what the teacher's assignment to me was....In most actual Blackjack games the dealer starts with one upcard showing. Your task is to calculate the dealer's bust probability for each possible starting value. Your program should report a value for each possible starting card from Ace (1) to Ten. … | |
Hey. I'm importing an array in a text file via [icode]array=numpy.loadtxt("testdata.txt")[/icode]. Is there an easy way to count the number of rows and columns? Maybe something like [icode]x=numpy.countrow(array)[/icode]? I've had a look around and couldn't find anything suitable. Thanks, Alex | |
This is graphics.py from the zelle book. The following code seemed to be working but when i added the parameters to the function def drawEye(win, centre, radius): i get an error when i try to execute it Traceback (most recent call last): File "C:\Documents and Settings\Compaq_Owner\Desktop\t.py", line 22, in <module> … | |
I am having problems with my reverse polish calculator code. The code is as follows: [CODE]import operator OPERATORS = { '+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.div, } class Stack(object): "Creates a stack to enter numbers or operators into" def __init__(self): self.storage = [0,0,0,0] self.sptn = -1 def push(self, … | |
Assume I have a file of the following format: a,1 b,2 c,3 d,4 Here is my code: [CODE]def junk(f): d1 = {} d2 = {} for line in f: columns = line.split(",") letters = columns[0] numbers = columns[1] d1[letters] = numbers d2[numbers] = letters return (d1, d2) def something(): print … | |
Python can use its COM support and the OCX of the WindowsMediaPlayer to play mp3 music files. Make sure that your Python installation has the win32com folder. Check [url]http://starship.python.net/crew/mhammond/win32/Downloads.html[/url] for the latest win32com support. [COLOR="Red"]This code relies on file WMPlayer.OCX which MS has removed on newer versions of Windows. See … | |
I need to only allow integers and the letters "d" and "r" from raw input otherwise I need to run an exception. For example: [I]You entered 's' this is invalid[/I] I have tried to use try/except statements but can't work it out. Is this the best way? Can someone help? … | |
Assume I have a file of the following format: a,1 b,2 c,3 d,4 Here is my code: [CODE] def junk(f): d1 = {} d2 = {} for line in f: columns = line.split(":") letters = columns[1] numbers = columns[2] d1[letters] = numbers d2[numbers] = letters return (d1, d2) def something(): … | |
I have to get pthagaros to get the distance between 2 points. so the function distanceBetweenPoints(Point(1, 2), Point(4, 6)) should result in 5.0. the parameters are supposed to be P1, P2, which i think i have done?. The get an error when i try to execute this?.. help please def … |
The End.