15,190 Topics

Member Avatar for
Member Avatar for HTMLperson5

I need some ideas for the python text based game i am making, it looks like this so far: from time import sleep import sys #Functions set at start of code def helpme1(): for a in 'Recognised commands are: explore, help, suicide, flee, look, get,open door, run and attack. With …

Member Avatar for Gribouillis
0
4K
Member Avatar for anonymous0502

How to share variable between multiprocessing and Pyside application. I am a newbie.Can anyone help me?Any suggestion will be appreciated.Thanks very much. This is my demo: #!/usr/bin/env python #coding:utf-8 #demo:pyside gui application communicate with multiprocessing.Process() import sys,time import multiprocessing as mp import logging,logging.handlers from PySide.QtCore import * from PySide.QtGui import …

Member Avatar for vegaseat
0
540
Member Avatar for pythonbegin

Hi All I am working on a html parser 'selenium webdriver' and on one of the pages I found an image with text on it.The page contains other information as well. I tried to see the page source if I can extract the text on image using webdriver but I …

0
100
Member Avatar for bkjfdghiuds

hello I am following this tutorial on how to scrap website information http://www.newthinktank.com/2010/11/pyt ... -scraping/ this is my code: EDIT: do not post off site, moved here #! /usr/bin/python from urllib import urlopen from BeautifulSoup import BeautifulSoup import re def cleanHtml(i): i = str(i) # Convert the Beautiful Soup Tag …

Member Avatar for snippsat
0
2K
Member Avatar for srk619

need some help on the coding can some plz help the question is: A year is a leap year if it is divisible by 4, unless the year is a Century, in which case it is only a leap year if it is divisible by 400. Write a function which …

Member Avatar for HiHe
0
646
Member Avatar for jcmeyer

I would like to copy a row in a database and change one value. I think that this is close to what I am supposed to do. [CODE] self.cursor.execute("INSERT INTO DatabaseName (C1, C2, C3, C4, C5) SELECT (?, C2, C3, C4, C5) FROM DatabaseName WHERE C1=?", [newC1Value, copiedC1Value]) [/CODE] Although, …

Member Avatar for webstart
0
218
Member Avatar for 4evrmrepylrning

My brain is freezing up again. I have a string that looks something like this `1 apple--1 pear--1 peach--2 onion--2 carrot--3 <bee mince--3 <por chops--4 <oth salad:--potato--4 <oth bread:--garlic` Then I have a few dictionaries: dic1 = {'1': 'fruit', '2': 'vegetable', '3': 'meat', '4': 'other'} dic2 = {'bee': 'beef, 'por': …

Member Avatar for 4evrmrepylrning
0
216
Member Avatar for sabid

import maya import sys import os from functools import partial import maya.cmds as cmds def customVer(FileName, version): #create a file path with the file you have and version you want version = 9000+int(FileName[(location-3):location]) newFileName = str((myFileName[0:(location-3)])) version = str(version-1) version = version[1:] newFileName = newFileName+str(version) return newFileName def newFile(myFileName): #find …

Member Avatar for TrustyTony
0
292
Member Avatar for klevasseur

I have some text files (actually csv) that have the extension .ROS stored on a server and I can't seem to open them in Python. If I change the extension to .txt or .csv, I can open them fine either as text or csv, but I'd rather keep the .ROS …

Member Avatar for vegaseat
0
133
Member Avatar for jaysb

hello sir i have python code can u convert it into java . code is below..... plz help............ # Ad-hoc algorithm for copy-move forgery detection in images. # Implemented by - vasiliauskas.agnius@gmail.com # Robust match algorithm steps: # 1. Blur image for eliminating image details # 2. Convert image to …

Member Avatar for TrustyTony
0
4K
Member Avatar for drichird

In Python: #python class myClass: istat = 111 #exists as soon as import class def __init__(self): print("in ctor") self.iauto = 222 #does not exist until instance created ..... mc1 = myClass() mc2 = myClass() In C++: //C++ class myClass { public: static int istat; int iauto; }; ..... //main myClass …

Member Avatar for Gribouillis
0
804
Member Avatar for aot

As a psychologist, it's useful to be able to time people's reactions in milliseconds. What kind of accuracy could I expect to get in this regard from Python? From what I've read so far, it doesn't look like I can hope to get precise enough timing to get reliable results, …

Member Avatar for BBTK
0
9K
Member Avatar for evvo69

hi, i am a complete newbie on software development onlt a couple of weeks, currently working through a manual and one of the chapter challenges is to create a number guess game in a GUI enviroment. been trying to look for tips on the web to no avail. i am …

Member Avatar for evvo69
0
2K
Member Avatar for idislikemacs

I need a timer that shows the total elapsed time it took for the user to complete the game. I'm running Python 3.2, pyscripter 2.5.3. I'm using "timer.timer" but I'm having trouble. I want the timer to reset when the user inputs "reset", but still keep a running total in …

Member Avatar for memomk
0
144
Member Avatar for xander345

Are there any python cgi proxy script out there, i know there are perl and php ones but there any in python, as i want to update the script on http://send2source.net into something i can better understand

0
157
Member Avatar for adam93

"Add a function to the sets module called issubset with a function signature issubset(set1, set2). Your function should return True if every element in set1 appears in set2. Make sure you document your function fully and remember to include preconditions and postconditions. Also, include some testing for your new function." …

Member Avatar for HiHe
0
87
Member Avatar for weblover

hi i have an aligmenet file which contains 3 species generated from clustalx AAAACGT Alpha AAA-CGT Beta AAAAGGT Gamma i already sliced the aligment using the predefined indexing in biopython `align[:,:4]` but now when i print the result i get: AAAA Alpha AAA- Beta AAAA Gamma the questions is: how …

Member Avatar for weblover
0
284
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
83
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
121
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
333
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
549
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
96
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

The End.