14,949 Topics

Member Avatar for
Member Avatar for thanadaray

I am trying to update into table if score > 0 but nothing display into table. if score > 0: note = "more" update = "UPDATE Sentence SET Note = %s WHERE score = %s" c.execute(update, (note[0], score)) Did I miss something?

Member Avatar for thanadaray
0
80
Member Avatar for thanadaray
Member Avatar for thanadaray

import MySQLdb import csv import sys db = MySQLdb.connect("host","username","password","dbname" ) c = db.cursor() select_pos_score = 'SELECT score FROM Sentence' c.execute(select_pos_score) I use MySQLdb. I want to display all score that are selected from table "Sentence" but I do not know how to display it. Any suggest for me to display …

Member Avatar for thanadaray
0
92
Member Avatar for sinnebril

Hi there! I have been searching on the forum and google, but I can't find a clear answer to my problem. What I can find is how to read data from a file, but not from specific cells in Excel. A small example of the [B]input[/B] Excel file: [CODE] An/gene …

Member Avatar for pk87
0
3K
Member Avatar for geansra

if Julian_Date > Base_Date : Target = (Julian_Date - Base_Date) % 28 print First [Target], Second [Target], Third [Target] Shift_Set = [First [Target], Second [Target], Third [Target]] elif (Julian_Date < Base_Date) & (Julian_Date != 28) & (Julian_Date !=0): Target = (Base_Date - Julian_Date) Shift_Set=[First[(28- Target)],Second[(28- Target)],Third[(28- Target)] else pass #the …

Member Avatar for vegaseat
0
120
Member Avatar for albertHankock

So I need to write an ping client and server for my networking class. Server code is running no problem but I'm a bit lost on my client code. I copy and pasted the server code because I figured it would be easier to modify.. Please check this out.....THE PROBLEM …

0
323
Member Avatar for TrustyTony

Gribouillis has allready posted code similar to this in his snippets, but here version for input suitable for for expressions, generators and list comprehensions. Need to add robustness by some try...except blocks for real world use.

Member Avatar for vegaseat
0
540
Member Avatar for Acidz

Hi, been sometime since I posted here... Okay strait to the point: I'm having trouble getting my head around coordination system for a game. So lemmy explain a example; I use panda3d which uses python, ofc i'm programming in python. So the question. I want to create a coordination system …

Member Avatar for Acidz
0
203
Member Avatar for Gribouillis

This code snippet provides methods to convert between various ieee754 floating point numbers format. For example double precision to single precision. The format is given by a pair (w, p) giving the size in bits of the exponent part and the significand part in the ieee754 representation of a number …

Member Avatar for TrustyTony
1
5K
Member Avatar for thanadaray

How to check if table exist? **I would like to check if table exist then drop table. If not exist, create table.** My codes at this moment: import MySQLdb, csv, sys db = MySQLdb.connect("host","username","password","databasename" ) # prepare a cursor object using cursor() method c = db.cursor() # Drop table if …

Member Avatar for vegaseat
0
8K
Member Avatar for Bungie

I need help creating a pause screen for my pong game. Also if you could make a way to make the game fullscreen that would be great. Here is the code: import pygame, sys, random, os from pygame.locals import * import screen import screem os.environ['SDL_VIDEO_CENTERED'] = '1' # Pygame init …

Member Avatar for TrustyTony
0
272
Member Avatar for kur3k

Hey ( sorry for my english ) I use zimbra, which has caldav implementations caldav. I try create new event in calendar for my simple client ( which use caldav python library ). I dont now what type of url for save new event in caldav library python. ( sorry …

Member Avatar for TrustyTony
-1
95
Member Avatar for hhol1101

Hi everyone, I'm new to python and I have been trying to get this program to word but I don't know how to get the image cards to shuffle randomly and then appear on the graphics screen. Can anyone help me? The question was to create a program that displays …

Member Avatar for TrustyTony
0
2K
Member Avatar for valorien

Hi Everyone, I have a list of numbers I'm trying to write to a file, which I want to be a binary file. Here's my code: nums = [0x1234, 0x5678, 0xabcd, 63, 44] with open('filename', 'wb') as bin_file: for number in nums: bin_file.write(number) The problem is that I keep getting …

Member Avatar for valorien
0
538
Member Avatar for frivolous

Hi, I am making a music player in python 2.6 with Tkinter. Here's my code : from Tkinter import * import mp3play import tkFileDialog import Tkinter def open_file(): #Opens a dialog box to open .mp3 file global music #then sends filename to file_name_label. global mp3 global play_list filename.set (tkFileDialog.askopenfilename(defaultextension = …

Member Avatar for TrustyTony
0
522
Member Avatar for Bamahonky

I am trying to teach myself Python. I have started out creating several small programs. This one area has me stumpped. I have created a simple password saver program. I thought using a dictionary would be the best option. The only problem I have ran into is I cannot get …

Member Avatar for Bamahonky
0
182
Member Avatar for TrustyTony

This came up, maybe it is usefull to somebody. Later I plan to do a managing context interface to `with`statement for this.

Member Avatar for TrustyTony
0
2K
Member Avatar for kuchi

We have been getting this error and needs to be fixed. We use python code to connect to LDAP and this is trowing the following ldap.SERVER_DOWN: {'info': 'TLS: hostname does not match CN in peer certificate', 'desc': "Can't contact LDAP server"} Is there a way to ignore this name mismatch? …

Member Avatar for TrustyTony
0
211
Member Avatar for neilaggarwal

I would like a user to select text on a webpage, and to capture that text as a string automatically using the least number of user inputs as possible. Ideally, the user would simply select the desired text using ctrl-c, immediately after I would run the GetClipboardData() function and obtain …

Member Avatar for vegaseat
0
1K
Member Avatar for debasishgang7

Hi All, I wanna generate all possible combination of certain list using python. For Example I have a list like list = ['A','B','C'] I wanna generate all possible combination of these list elements like using "itertools": AAA AAB AAC ABA ABB ABC ACA ACB ACC BAA BAB BAC BBA BBB …

Member Avatar for TrustyTony
0
1K
Member Avatar for NeoSyn

Recently i've been coding my own game, it was working fine up to a point but suddenly the backround is moving over the sprites drawn to the screen... I've loaded them unto the screen alright, and sometimes when i run they actually do come out on top. Here's my main: …

Member Avatar for vegaseat
0
458
Member Avatar for lostlibearlarts

Hi All, I am working on a project for school. Notice that I am a liberal arts major. My project is to develop a multiple choice test. I decided it would be a cool time to teach myself how to program so people could take the test on the computer. …

Member Avatar for TrustyTony
0
172
Member Avatar for KickAssElmo

I have two arrays: n = [30, 47.2, 70.2, 77.4, 36.3, 20.6, 18.1, 21.4, 22, 25.4, 27.1, 40.3, 57, 76.6, 52.3, 19.5, 11.2, 7.6, 14.6, 16.2, 24.7] p = [4, 6.1, 9.8, 35.2, 59.4, 41.7, 19, 13, 8.3, 9.1, 7.4, 8, 12.3, 19.5, 45.7, 51.1, 29.7, 15.8, 9.7, 10.1, 8.6] …

Member Avatar for TrustyTony
0
100
Member Avatar for athulram

Though I've seen some modules and stuff for doing this they seem to deprecated. So how do you use python to update your status on Facebook? (Please provide examples to explain) Thanks In Advance,

Member Avatar for TrustyTony
0
126
Member Avatar for Razrak

Greetings. I did not write the below code. I got it from [Click Here](http://itknowledgeexchange.techtarget.com/itanswers/python-script-to-download-wallpapers-from-interface-lift/) Thanks for any help. When I try to check the syntax it gives me an error on the very last line of code. The error "SyntaxError:invalid syntax (line 119, offset 26):a.getWallpaperList()[/pre] #!/usr/bin/env python import urllib2 import …

Member Avatar for TrustyTony
0
336
Member Avatar for minimee120

Problem 1: Phone book. A phone book file is organized so that each line is an entry for one person. Each line has the following format: first, a name (one word, no spaces), then zero or more phone numbers, each preceded by a space (no spaces within a phone number). …

Member Avatar for Lardmeister
0
204
Member Avatar for pawel1

Hi there one and all. I am attempting to learn to code in python with the intention of teaching it to a class of 12 year olds later in the year!!! So far I've been going ok if a little slowly, however this one is stumping me. I am trying …

Member Avatar for TrustyTony
0
250
Member Avatar for weblover

Hi, i'm new to python and I'm having a problem that I'm not able to solve. I have the following 2D array: valuearray = [['A', '21', '45'], ['A', '12', '23'], ['A', '54', '21'], ['A', '15', '54'], ['B', '23', '53'], ['B', '34', '53'], ['B', '32', '54'], ['B', '24', '13'], ['C', '31', …

Member Avatar for Gribouillis
0
432
Member Avatar for minimee120

Problem 2. tttCheckMove() Write a function named tttCheckMove() that checks whether or not a TicTacMove is on an empty space on a TTT board. Input (two parameters): ยท Parameter 1: A string of 9 characters denoting the state of a TTT board. Each character in the string indicates the state …

Member Avatar for minimee120
0
179
Member Avatar for TrustyTony

Here slightly edited code from one of my earliest posts to DaniWeb. Limitted by recursion limit of Python as it uses recursion, but interesting for me.

Member Avatar for TrustyTony
0
1K

The End.