14,951 Topics

Member Avatar for
Member Avatar for G_S

I have this: dic = {'ál':1, 'él':2} string = "ÉL" number=dic[string.lower()] and it's giving me a KeyError. I realize then that 'ÉL'.lower() is giving me 'Él', i.e. it is not affecting the É at all because some weird Python 2.x encoding issue. Can somebody help me please? I can't tell …

Member Avatar for G_S
0
1K
Member Avatar for bnn678

a1 = 1 a2 = 2 a3 = 3 ....... a10000 = 10000 So, I want to create a function that will autoassign names to numbers. In the the code above, for x in range (desired range): a(quantity of x) = x how do i get my code to call …

Member Avatar for Gribouillis
0
210
Member Avatar for brittany.nelson.526

I am having a problem with a loan calculator that I am building. It keeps telling me that the interest_rate variable it referenced before assignment. I'm fairly new to python and was wondering if anyone had any ideas as to what is wrong with my code. Any help would be …

Member Avatar for TrustyTony
0
318
Member Avatar for novice20

hi all... how to find the localhost ip address in python [B]import socket socket.gethostbyname(socket.gethostname())[/B] gives me 127.0.0.1 instead of my ip address any help...........

Member Avatar for Suraj_2
0
906
Member Avatar for karmstrong

I'm wondering if anyone has any experiencing getting a python application to authenticate with google docs. I'm not sure how to begin. Goal: To update a google docs spreadsheet based of a CSV file on my local machine. Currently my google account is set for two factor authentication. Perhaps this …

Member Avatar for dashing.adamhughes
0
249
Member Avatar for krystosan

getting errror related to pkg_resources while running PIP PIP install cython Traceback (most recent call last): File "/usr/local/bin/PIP", line 6, in <module> from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module> working_set.require(__requires__) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require needed = self.resolve(parse_requirements(requirements)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve raise DistributionNotFound(req) …

Member Avatar for Gribouillis
0
512
Member Avatar for james.lu.75491856

How would I use [web.py](http://www.webpy.org) to execute ASP/PHP server files? Or can web.py not do that and can someone provide me a python script that can execute ASP/PHP server files? Should I try posting this in the PHP forum, Web Design, html, and css fourm, or the Web development forum …

Member Avatar for cereal
0
366
Member Avatar for crebz

Hi am kinda new in python programing. I have this game that involves a user inputs a value , say color it iterates over imported modules( in this case color) and prints data about it. The problem is that i cant get to code the best way to iterate over …

Member Avatar for crebz
0
231
Member Avatar for karmstrong

I'm attempint to write a python application that will open a .csv file and look at comun one for certain string. If the string match print the row to a new .csv file. import csv input_file = csv.DictReader(open("stats.csv")) for row in input_file: print row

Member Avatar for Gribouillis
0
569
Member Avatar for Maurice_3

I have a package of python modules that I need to import to another module. Wi use of user input of a string or interger, the module is to iterate over the list of the modules to find the one with an answer as follows. from hometests.clauses import * # …

Member Avatar for Gribouillis
0
1K
Member Avatar for tony75

Hi I have simple python script that open a TCP socket,connect to the SMTP servert and issue a VRFY command. When I run the script I got error,I wonder How can I fix error? #!/usr/bin/python import socket import sys if len(sys.argv) != 2: print "Usage: vrfy.py <username>" sys.exit(0) # Create …

Member Avatar for tony75
0
1K
Member Avatar for marium.aslam.18

“Guess the number” game One of the simplest two-player games is “Guess the number”. The first player thinks of a secret number in some known range while the second player attempts to guess the number. After each guess, the first player answers either “Higher”, “Lower” or “Correct!” depending on whether …

Member Avatar for BearofNH
0
278
Member Avatar for lewashby

greens = dict(green="#0080000", olive="#808000", lime="#00FF00") >>> print("{green} {olive} {lime}".format(**greens)) -> #0080000 #808000 #00FF00 In the program above what are green, olive, and lime in the dict function? I've seen and read about supplying a function with keyword arguments but only when the function was written with default argument. Even then …

Member Avatar for TrustyTony
0
160
Member Avatar for johnroach1985

I am currently trying to write a simple multi-threading program using Python. However I have run on to a bug I think I am missing. I am trying to simply write a program that uses a brute force approach the problem below: ![376dc6dd28649dd49ee987fbaf913b75](/attachments/small/0/376dc6dd28649dd49ee987fbaf913b75.gif ) As can be seen from the …

Member Avatar for Gribouillis
0
230
Member Avatar for np complete

I want to extract this data from a website `You need to add the numbers present in this string. Your string is: 3754537dd2f082ad578e0ff1806d86a6` This is what I was doing url = opener.open('http://www.website.com') data = url.read() extract = re.search('your string is: <strong>(.*)', data) ans = extract.group(1) ans = string.split(ans, '</strong>')[0] print …

Member Avatar for snippsat
0
253
Member Avatar for lfc3798

I want a code in python, to convert binary to decimal however i want the user the choose which way to convert the number(i.e, binary to decimal or decimal to binary) thank you

Member Avatar for TrustyTony
0
267
Member Avatar for Tcll

lol don't take any offence to the title XD just being funny :P anyways... I'm having a problem with my function... it's supposed to allow you to read/write float values in any specified byte length. but there's a problem with the output value >_> first off though I must state …

Member Avatar for Tcll
0
812
Member Avatar for Sarfaraz_1

Looking to test my library and implementing it so that insert function can assign the index of the rear in th e ring after the items are inserted in ring class CircularQueue: def __init__(self, size): """ ------------------------------------------------------- Initializes an empty queue. Data is stored in a list. ------------------------------------------------------- Postconditions: Initializes …

Member Avatar for TrustyTony
0
723
Member Avatar for powerson65

Hi i am new to python and i am trying to create a GUI application which will hold different games aimed for autistic children, from where these games can be played. I have imported the scripts to the Gui application area as follows from tkinter import * from tkinter.messagebox import …

Member Avatar for powerson65
0
3K
Member Avatar for ankman

Im new to programming python3 and i'm trying to write a password program. i want to compare a word from a .txt file with a input. no matter if i type the password in write or wrong it always comes up 'access denied!' inFile = open('passwordtest.txt', 'r') password = inFile.read() …

Member Avatar for Gribouillis
0
2K
Member Avatar for Maurice_3

Hi am a newbie in Python. I have this code for a game where a client types in e.g. as illustrated several cities and the code works out a combination to open a vault. It works well without a while loop but i want a loop where: 1. The first …

Member Avatar for Anima Templi
0
239
Member Avatar for Marcello_1

What I am trying to do is create a form that is automatically generated and then the values from that form are then used to proceed in the program. Currently to generate my form I am using this function `real_names=["Jason","Casandra"]` this portion of the code is not static it is …

0
168
Member Avatar for SumTingWong59

I am having difficulty with a program in my CS class right now and I am wondering if you guys could help. Basically, I need to find the length/width (should be equal) of the 4 corners(I'll call this variable 'x') of a piece of cardboard, to cut them out to …

Member Avatar for SumTingWong59
0
145
Member Avatar for Guillermo_1

import xlrd import re workbook=xlrd.open_workbook('planningSpreadSheet_20140120T124023_20140203-20140209.xls') sh=workbook.sheet_by_index(0) palabras=str(sh) for col in range(sh.ncols): for i in range(sh.nrows): caca=sh.row_values(i) print(caca) Hi , i try to do a seeker, read an xls file ,and find a word,(input()),and show all the content of the row

Member Avatar for BearofNH
0
183
Member Avatar for Tcll

so here's what I want to do: import module mvar = module() I've seen it done with the PyQt modules, but I don't feel like researching a complex code just to figure out a simple usage. :P anyone know how this works??

Member Avatar for Tcll
0
280
Member Avatar for zoro007

Hello, i want ask somthing about mysql in multi pages i hope someone help me and sorry about my English this code works good but there problem if i used it with this tybe sql = "SELECT * FROM emaillogs ORDER BY id DESC" cursor.execute(sql) results = cursor.fetchall() if page …

Member Avatar for zoro007
0
240
Member Avatar for Tcll

this is just as complicated as it sounds... but to try to simplify things, look at this image: http://lh4.ggpht.com/-_tyPL2KaJAQ/UIONlx4ZnBI/AAAAAAAAEJU/vU1429txSqk/s424/aglorithm.PNG I need the influence generation aglorithm's for both I1 and I2. here's what I currently have: http://lh5.ggpht.com/-_jX5pm2be18/UIMtH46GfoI/AAAAAAAAEIk/Btswj9Lw4iA/s640/DM%2520prg2.PNG please help I've been doing google searches for the bezier aglorithm, but havn't come …

Member Avatar for Tcll
0
123
Member Avatar for Tcll

so basically... what I want to do is identify the function calling the dynamically created/referenced class let's put this simple... I have 2 functions, both of which either create or reference the same class based on an input... this function then returns the class with specifically set parameters. (not an …

Member Avatar for Tcll
0
274
Member Avatar for Tcll

so basically... I have a dynamic memory sub-system that does this: d = bu32() # a value from dynamic memory (such as 2) print d print type(d) p = ref(d) # a pointer deref( p, bu16 ).set(10) # short *p = &d; *p = 10; //(not sure if correct) print …

Member Avatar for Tcll
0
244
Member Avatar for Tcll

first off, I hope it's not against the rules for me to request optimization... :x I've tried to write the code with my best understandings of python optimization (which isn't much). def ov( value, byte_size ): sign = False if value<0: value += 1; sign = True value = abs( …

Member Avatar for Tcll
0
176

The End.