15,175 Topics

Member Avatar for
Member Avatar for hunterm

I thought I understood how tuples work, but that is not the case. [code=python] lose = ['skldhf', 'laweoirht', 'skdljhflkjhs'] print lose [/code] How would I get it to print of the three phrases randomly? No, those aren't what I will be actually using, I just haven't come up with what …

Member Avatar for hunterm
0
115
Member Avatar for CommanderOne

Hey, I'm new to the language and was hoping someone could give me a bit of a hand. [language=code]def common_elements(list1, list2): """ Return a list containing the elements which are in both list1 and list2 >>> common_elements([1,2,3,4,5,6], [3,5,7,9]) [3, 5] >>> common_elements(['this','this','n','that'],['this','not','that','that']) ['this', 'that'] """ list3 = [] for item …

Member Avatar for CommanderOne
0
84
Member Avatar for bhanu1225

Hello All. I created a login form, which has two fields named "USER ID " & "PASSWORD". Here, i took 8 character length for USER ID field. I would like to take "THE" as first three characters as constant in USER ID field. So, is it possible to do it? …

Member Avatar for bhanu1225
0
73
Member Avatar for wavefront

Hello, I am new both to here and to Python. This is my first attempt at writing an actual code in Python 3; I've run into a problem with my class declaration, however. It may be a glaringly obvious problem, but it's not to me, so hopefully someone might spot …

Member Avatar for wavefront
0
134
Member Avatar for jdoppke

I'm trying to do some simple DDE to talk to another windows process. Does anyone have any examples of creating a connection, sending a query and getting the results? I'm finding zero documentation on the DDE module. The demo directory that came with it has very little.

0
38
Member Avatar for CommanderOne

Hey, Kinda new to this, and trying to assemble some simple code, but I'm having a couple of issues that I hoped someone would be able to help me out with. 1) I would like to be able to remove duplicates from a submitted sentence, leaving only the first occurance …

Member Avatar for woooee
0
135
Member Avatar for Deman

I've got a Frame Object that creates all the GUI for my program, and I'm trying to call it in my main function and send it some arguments to use. However, I cant figure out where I need to add them into the object so that it will except them …

Member Avatar for woooee
0
156
Member Avatar for txwooley

I am fairly new to Python, but trying to make a poker game. How do I determine the winner? I have 'scored' the hands 1-8, and given sub-scores for the high card, but how do I compare the scores of 4 players and then in the event of a tie, …

Member Avatar for txwooley
0
337
Member Avatar for tomtetlaw

Is there any way to check if the script is being run in the Windows command line?

Member Avatar for _Nestor
0
62
Member Avatar for comfixit

I have the following CSV file ['ID', 'ABD', 'ABD', 'ABD', 'ABD', 'ABD', 'PC'] ['1', 'N400', '', '', '', '', 'P1000'] ['2', '', 'N401', 'N402', '', '', 'P1001'] ['3', '', '', '', 'N500', '', 'P1002'] The data is not stored in an ideal format. The first row has some pretty useless …

Member Avatar for targ
0
252
Member Avatar for pvi101

Hi all, I am a Python Newbie and started learning it with this book "Programming in Python 3", which has a lot of sample codes. So I am using Python 3 and got stuck while trying this program.The program is to swap the elements in the Tuple and how to …

Member Avatar for supernovicevn
0
197
Member Avatar for Kekalove

help me design a For loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50......1000

Member Avatar for slate
-2
100
Member Avatar for Whelk

I'm trying to set up a login procedure. Here's what I'm trying: [code="python3"] import users import sys print() print("Please enter your username.") print() username = input(">") if username not in users.usrlist: print() print('User does not exist.') sys.exit() else: user = users.username print() print('Please enter your password. Note that for security …

Member Avatar for woooee
0
144
Member Avatar for Prahaai

Good day. I have a problem with matrices / arrays, i cannot resolve. I have no idea how to start... I have two 2D matrices and i want to overlap (mix?) one over the other, no matter what dimensions they have. For example : a = [ (1,2,3,4,5), (9,7), (0,0,0,0,0), …

Member Avatar for scru
0
277
Member Avatar for hazyvisions

I'm using python 2.6 64-bit and py2exe 64bit I want to make my program runnable for people who have 32-bit windows. Any help? Do I have to install and use python 32-bit version or is there a workaround?

Member Avatar for leegeorg07
0
31
Member Avatar for dinilkarun
Member Avatar for dinilkarun

Hi All, I have created a grid and want to implement the following idea: The user should be able to enter only numeric values in any of the cells in that grid. I could not get any property of the cell which can check for the entered data. Please guide …

Member Avatar for lllllIllIlllI
0
136
Member Avatar for you2

Hi , I'm a newbie to python. I would appreciate if someone can help me in solving this one. Say i have a string [b]str1 = "a:1,a:2,b:3,c:4"[/b] I want to get output in form of a dictionary like [b]d= {a:3 , b:3 , c:4}[/b] i.e if in the string[b] a[/b] …

Member Avatar for you2
0
118
Member Avatar for Whelk

I'm having a blast coding up my little text-based python game. I'm learning a heck of a lot while doing it. Now, I want to share it with some friends. I could just have them install Python and send them the files, but I was wondering if I could somehow …

Member Avatar for shadwickman
0
142
Member Avatar for samush

I'm trying to write a script thats spawns a fortran program that needs std file input i.e. you would open it in bash with: [ICODE] ./program < input [/ICODE] How can I do this in python? I have tried the os.spawnl() and it spawns the process but the input does …

Member Avatar for woooee
0
140
Member Avatar for ldk

Hello, I have a wxPython interface to an application (.pyw). I want to be able to run the application also from commandline to start the application as a batch procedure with the desired parameters. If the application runs and parameters are available (sys.argv), I run, from the commandline without the …

Member Avatar for jlm699
0
114
Member Avatar for ifemi

Hi all, i need help on how to change a grid line((x1,y1), (x2,y2)) to another color. I have a 6 * 6 grid(black lines), made using pygame and i want to change the colour, with response to a mouse click on the coordinates. Is this possible? Below is the code …

Member Avatar for ifemi
0
100
Member Avatar for davhuang

I am trying to write a program to do the hill cipher technique of encryption. I am stuck trying to break the large array of numbers representing letters etc. into multiple smaller arrays with one column and two rows does anyone know how this could be done?? Here is the …

Member Avatar for jlm699
0
259
Member Avatar for bobstein

I'm writing part of a program that involves writing user generated information to a text file. [code]class MonsterStats: def __init__(self, name): self.__monName = name def setName(self, name): self.__monName = name def fileWrite(self): monFile = open('MonsterFile.txt', 'w') monFile.write(self.__monName) monFile.close() [/code] I wrote this to test it out: [code]import MonsterClass name = …

Member Avatar for jlm699
0
108
Member Avatar for applebiz89

I'm not really to sure with using python and its object oriented features as Im better with java. Im not sure whether to put the functions inside the classes as i can't really seeing this making a difference. I will apply my code and any changes or guidence would be …

Member Avatar for jlm699
0
238
Member Avatar for mr.g.at.lot33

Hello to whom ever can help me out there. I have created a game where the player selects on a suit to bet. this suit will be shared among three dice. if the player gets his symbol shown up on all the dice he wins three times the bet amount, …

Member Avatar for woooee
0
462
Member Avatar for clR3vv

Well I decided to work on a GUI for this because I need the practice. However I ran into this weird problem. If I change line 67 from 1000 to 100 my program prints two of the last letter... [url]http://pastebin.com/d656cfd09[/url] (with 1000) [url]http://www.grabup.com/uploads/195f84b4dab3...f199.png?direct[/url] with (100) [url]http://www.grabup.com/uploads/8fd5d3d988ec...b568.png?direct[/url] That just makes no …

Member Avatar for clR3vv
0
325
Member Avatar for ning2009

Hi, there I have been confused about format control of List. My problem is that I get strange format when exchanging List[-1] with List[-2] using a middle variable. My code is to handle a text file. Old code in a For loop is: [QUOTE]sinf.write('*element,type=s4r,elset=WSLAB\n') path4b2_value[0]=str(int(path4b2_value[0])+100000) path4b3=','.join(path4b2_value) sinf.write(path4b3)[/QUOTE] which produces a …

Member Avatar for ning2009
0
128
Member Avatar for scheda

I'm having a little trouble running wxPython. I did a little Googling and didn't find a whole lot though. Here is a sample of what I'm trying to run... [ICODE]import wx app = wx.PySimpleApp() frame = wx.Frame(None, wx.ID_ANY, "Hello World") frame.Show(True) app.MainLoop()[/ICODE] This code is straight from the tutorial provided …

Member Avatar for vegaseat
0
135
Member Avatar for chardson

hi there, i'm using the PyArg_ParseTuple() function in my python bindings for some C code. the code i'm wrapping has two functions, one that returns a default value instead of an error if an error would have occurred, and one that returns an error. i simply want to use one …

Member Avatar for scru
0
177

The End.