15,190 Topics

Member Avatar for
Member Avatar for vegaseat

The map() function applies a function to every member of a list. Here a list of numbers 32 to 255 is changed to a list of the corresponding ASCII characters. Then map() is used in a more complex application to combine the two lists to form a dictionary containing number:character …

Member Avatar for Gribouillis
0
434
Member Avatar for knan

I have a list of lists [CODE]x=[['a', 'b', 'c', 'd'], ['e', 'f'], ['g', 'h']][/CODE] I need the following output. [CODE]a-b a-c a-d b-c b-d c-d e-f g-h[/CODE] How can i do this? Can a regular expression be used here??

Member Avatar for Gribouillis
0
152
Member Avatar for sravi.pearl

haiii Do anyone know how to convert array like this ['26','18','20'] into [26 18 20] because i have to plot graph for these value, ['26','18','20] array is not allow me to do that ,i got ['26','18','20'] from database table with data type varchar....problem is i shouldnot change the datatype .... …

Member Avatar for TrustyTony
0
91
Member Avatar for novice20

[B]hi... I have a value, value=4501-E001 I am concerned about only the value before hyphen i.e., 4501 I need to check whether various values begin with 4501, followed by something, n am not concerned about "something" that follows. How can this splitting be done in python?[/B]

Member Avatar for Gribouillis
0
128
Member Avatar for UaBoy

I am making a program for my CS class. Is there a way, in python, to set more than one value to a variable? Am I thinking about this in the wrong way? I need to make a program that asks a bank account holder for their username. If that …

Member Avatar for TrustyTony
0
119
Member Avatar for kumar86

hello guys suppose if want to open a file in Notepad application, it have short cut key(shift+ctrl+o). So to open a file, using the short cut key, i have to write python script. could please give some example. Regards kumar

0
56
Member Avatar for kumar86

hello guys, I am writing automated python script. How can i propagate the result of each script in XL sheet, whether the script is passed or failed. could you please help me For example , my first script is to verify 'open an existing project' and second script to verify …

0
49
Member Avatar for kumar86

hello guys, I have written a script to open notepad and added the text in script, after that i want to save the file in text format. from pywinauto import application from pywinauto import application app=application.Application() app.start_('Notepad.exe') app.Notepad.edit.TypeKeys('hello') app.Notepad.MenuSelect("File->Open") app.Notepad.MenuSelect("File->Save")/*saveas dialog box opened and waiting for the filename*/ Please guide …

Member Avatar for kumar86
0
106
Member Avatar for sravi.pearl

hiiii all, Can anyone please help me regarding this .... i have table with 2 cloumns in a database "details" Name Age john 26 Mary 18 Nancy 20 i want to get only the Age in an array. I tired in this way: db=MySQLdb.connect(user="root",passwd="my",db="mydb") cursor=db.cursor()# prepare a cursor object using …

Member Avatar for sravi.pearl
0
205
Member Avatar for ChaosKnight11

Hi, I want to start preparing for an IT Olympiad for next year for a chance to get a full bursary for college. We can choose between Java, Python, C and C++. Of the lot I'm most comfortable with Python seeing that I at least have a bit of experience …

Member Avatar for woooee
0
182
Member Avatar for suntom

Hello, new coder here :-) I've been working on one of my first scripts, an SMTP script for sending mail with Gmail. It works and all, but I wan't to have an "if" the login to the server failed, it would print and message saying so and return to the …

Member Avatar for richieking
0
1K
Member Avatar for knan

I have a file named test.txt I get the file [CODE]file=open("test.txt","r") obj=file.read() file.close() print obj a=a b=b c=c d=e e=d e=f f=e f=g g=h[/CODE] All I want to do with this obj is that, I've to create a regular expression such that, 1.If the left number matches the right number, …

Member Avatar for TrustyTony
0
201
Member Avatar for pssubash

How to communicate Python from PHP? i want to pass some arguments from my php page to python and python script process the arguments and returns the result.how it possible

Member Avatar for pssubash
0
116
Member Avatar for aint

is it possible to use the variable list from a function? here is an example? is it possible to call alist with its last used content? [CODE] def example(a): alist=[] alist.append(a) print alist example(1) print alist [/CODE] thanks

Member Avatar for Gribouillis
0
96
Member Avatar for G33KKitty

hey guys i was wondering if anyone knew of any tutorials on how to get Python to read and open a XML text file? any help would be much appreciated as i cant seem to find anythign!!! kitty

Member Avatar for Gribouillis
0
94
Member Avatar for kafro

I'm importing a .txt list of words into a dictionary and print, "The word seen most was XXXX and it was seen X times." I can import the .txt list into a dictionary and sorted my dictionary by value so my most seen word is at the end of the …

Member Avatar for kafro
0
125
Member Avatar for Syphilis

Ahoy Sailors! So there's two bits to my Python built software, The Parent and the child. The Parent comes in PE executable format so as you can simply right click and view the source. Now we're needing to do the same with the Child applications the Parent is going to …

0
61
Member Avatar for gis-brad

Hi, I am a beginner-novice programmer using Python to build custom tools in ESRI's ArcGIS. I have what seems like a simple problem, but I am afraid I'm missing a core concept. Here goes... In this simple example I assign string values to some variables and then change the text …

Member Avatar for gis-brad
0
295
Member Avatar for Bombshock

Heya Daniweb, I've been working on Regular Expressions, thanks to cghtkh who told me about them. I've used resources from: [URL="Newthinktank.com"]NewThinkTank.com[/URL] [URL="http://docs.python.org/library/re.html"]Python Regular Expression Documentation[/URL] and [URL="daniweb.com"]Daniweb.com[/URL]! I figured I'd share my code, ask a few questions, and get some feedback on what I did if I can. Feedback helps …

Member Avatar for TrustyTony
0
215
Member Avatar for pacers10

I have to write a table called tempconv.txt, the table should have temps from -300-212 fah and the cel equivalents with steps of 10 or 20, presented in 2 columns.I keep getting a syntax error. I think i am having trouble with the opening and closing of the file. Thanks …

Member Avatar for TrustyTony
0
162
Member Avatar for DocBreen

[CODE]import random name = raw_input("Write your name:") print "Hello",name,"you're about to play Hangman." print "Everything you get a wrong guess, you will get a {}, if the word were Nicky you'd get 5 tries." raw_input("Press [[ENTER]]") words = ["bat","girl","epic","blocks","block","chips","boy","fire","fox","school","community"] wordnum = random.randrange(1,11,1) hangword = words[wordnum] a = len(hangword) print "The …

Member Avatar for TrustyTony
0
109
Member Avatar for Iron-Man1138

This is program for figuring out cost of carpet at X length Y Width and Z cost/sqft (turned to yard). I am not very strong in looping yet, but I am pretty sure that is what has to be done here. Ideally at the end I want to ask the …

Member Avatar for TrustyTony
0
313
Member Avatar for Prachu

Hi all.. I am new to Python and badly need help...I am trying to run a DOS batch file from Python..I have given the inputs also..It runs half and then exits at the point of time when I need to give answer to whether I need to replace two files …

Member Avatar for changtraidoc
0
2K
Member Avatar for novice20

hi... how can this be done using python 1.prompting user for a file location from within a script 2.reading the file location entered by the user 3.storing it in a file like object

Member Avatar for novice20
0
82
Member Avatar for iwanttolearnc

ive been trying my hand on using modules to make my codes cleaner. i started off with a simple case. i created a module, usermodule.py, which i will pass to a main program openme.jpg - 640x480 [CODE] #this is usermodule.py import Image #image = Image.open ('openme.jpg') #imload = image.load() def …

Member Avatar for iwanttolearnc
0
122
Member Avatar for novice20

hi... am using pysnmp module to do an snmp get on a USB key status from pysnmp.entity.rfc3413.oneliner import cmdgen #--query on ccmSDIDUKeyStatus errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( cmdgen.CommunityData('xxx', 'xxx', 1), cmdgen.UdpTransportTarget(('192.168.5.157', 161)), (1,3,6,1,4,1,18489,1,2,4,2,8,0)) varBinds gives the following: [(ObjectName('1.3.6.1.4.1.18489.1.2.4.2.8.0'), Integer('2'))] I need to print the key status, based on varBinds, …

Member Avatar for novice20
0
989
Member Avatar for yari

I really need help with this...i'm trying to make a game that where user guesses a word and it tells the user 1: the right number of letter in the right place 2: the number of letter that is right in the wrong place but when i test it out, …

Member Avatar for TrustyTony
0
2K
Member Avatar for pythonlearning

When handling command-line arguments, I roughly know getopt will work, but have never used it before. The documents on some books seems not very informative, if read multiple arguments from the command line, is it right to use sys.argv[1], sys.argv[2], etc to assign the arguments to respective variable in the …

Member Avatar for pythonlearning
0
169
Member Avatar for knan

I have a set of text files in a folder. I want to read each file, convert the contents of the file to lowercase, remove punctuations and save them all in another directory with the same filenames. How can i do that???

Member Avatar for griswolf
0
320
Member Avatar for Teiji

Ok, I'm really really new to Python. I've installed Python 2.7 and is using IDLE (GUI). I just wrote 2 classes, Car and CarsDB, but I can't load them together to use them. [CODE] class Car(object): 'A car with its own information like make, year, model, price.' def __init__(self, mk, …

Member Avatar for TrustyTony
0
142

The End.