15,406 Topics

Member Avatar for
Member Avatar for anishxx323

How do i write a python code so that my list of numbers can be updated within an elif cause? I start off with an empty an empty list then from there i have to ask the user how many new scores they want to add to the list then …

Member Avatar for TrustyTony
0
273
Member Avatar for nerdnapster

Hello guys, I have a program created that opens a program and execute it as well. For example: filename = raw_input('Input a valid NAPS filename -> ') execfile(filename) I put my file helloworld.naps (my file extension) And it execute smoothly. Now my question is, how to verify the user input …

Member Avatar for nerdnapster
0
128
Member Avatar for amit9876

hi, I am developing a FIX client using python which is then meant to be executed using the "quickfixj" server. I have done the connectivity of python client with the "quickfixj" server. my roadblock : please help me how should I write the FIX protocol messages in the python client. …

Member Avatar for TrustyTony
0
32
Member Avatar for nerdnapster

I'm creating a simple module that have a cin and cout functions. This will accept the user input and display it afterwards. Just like this: text = napster.comein("Enter a number: ") napster.getout(text) I have a problem in the function code because I'm an amateur in python programming. This is my …

Member Avatar for nerdnapster
0
122
Member Avatar for techyworld

Hii need help for writing user input in a file. The following code is writing only the last word in a file. For example if user type "hello world", it will save only "world" in the file. I want to write the whole sentence in the file. for i in …

Member Avatar for TrustyTony
0
168
Member Avatar for techyworld

Hi, I write some data to a file called original.txt in python, then i read the file original.txt ,convert watever in the file to string(str), then write it in another file called copy.txt. Now i want to read the copy.txt and output it in python itself. It does not display …

Member Avatar for techyworld
0
367
Member Avatar for cruze098

How can you use a class 1's method in another class 2. Class 2 does not inherit class 1.

Member Avatar for Gribouillis
0
159
Member Avatar for mohsin.javaid.73

Hello Everybody. I am using Python for my code. I am trying to create folders at the end of a path. My path is /xxx/xxxx/xxxx/TEMP. I want to dynamicaly create folders after this path in my program. I want something like: /xxx/xxxx/xxxx/TEMP/Folder1. /xxx/xxxx/xxxx/TEMP/Folder2. /xxx/xxxx/xxxx/TEMP/Folder3. At the moment I am using …

Member Avatar for mohsin.javaid.73
0
136
Member Avatar for krystosan

Hello, I want to know and understand how and when do we need to implement classes in our code, I have written a program in python just using functions but never feel the need of using classes, so I was thinking when we can create something without classes why do …

Member Avatar for krystosan
0
192
Member Avatar for snakesonaplane

One thing I have been struggling with is moving from developing in Python to utilize Python on the web. All my web is currently handled with php, mainly through easy to install scripts/cms's such as Drupal, Wordpress and Joomla. Why? Because it is easy and they do 95% of what …

Member Avatar for snakesonaplane
0
241
Member Avatar for fml2012

Hello, I'm new to python and would really appreciate your help. for j in range(0,13): if files.startswith(name + ' ' + str(j)): do stuff This works for j= 0-9, but for j = 10, 11, 12 etc, it just sees the first numerical digit (eg.1). I assume I don't want …

Member Avatar for TrustyTony
0
160
Member Avatar for chao.lee.927

To display system clock time in LCD format I just want to display system clock time in LCD format, also want the time to be displayed with the format of hh:mm:ss ,my code is as following ,but when I run it ,it is out of my expectaions ,so anyone can …

Member Avatar for chao.lee.927
0
394
Member Avatar for shanenin

I am just back messing around a bit with programming. I am trying to clear out the mental cobwebs. I thought any non empty string evaluates to True. but according to my code, it does not apear so word = 'abc' if word is True: print 'yes' else: print 'no' …

Member Avatar for Gribouillis
0
112
Member Avatar for krystosan

class gui(): def selCon(self): print selection def create(self): inst=gui() cmds.button(l="Connect to Selected",command='inst.selCon()') I keep getting error saying name 'inst' is not defined # dont understand when method is in the same class and when I am making a call clicking the button i get this error message

Member Avatar for vegaseat
0
287
Member Avatar for mohsin.javaid.73

Need some hints/help in a stupid little problem. I have a list of files in a listbox. I want to get a selection of files from the list, add them in a playlist and play it using VLC. But I dont know how to start that bit. Any help will …

Member Avatar for glenwill101
0
145
Member Avatar for jaynew

Hi, i was having problem with a question i encountered. It was to create a life path program using python. However, i have no idea where to start. It says first to input the data for day, month and year. then it said to convert each day/month/year to a single …

Member Avatar for jaynew
0
119
Member Avatar for stevelll

I’m looking for a programming language that will: 1. Automate desk top processes running under Windows XP, like clearing the recycle bin & clearing recently accessed documents-programs under ‘Customize Classic Start Menu’, & 2. Open a Corel Paintshop program, run that program’s procedures & options, like optimizing photos, save the …

Member Avatar for tutux
0
172
Member Avatar for vivsshake

Hello everyone i am new to python and i have gone through articles but its not helping me in completing the following: I have something like this............ 10280341|2012-10-03 19:11:06.390|Sami|abc|Crossword|70 10280343|2012-10-03 19:15:32.173|Sami|aaa|Sudoku|30 10280355|2012-10-04 19:15:32.173|miami|bbb|Chaircar|15 10280366|2012-10-04 19:15:32.173|miami|bob|Avista|35 And what i want as o/p is this.......... 2012-10-03 Sami|2|100 2012-10-04 miami|3|50

Member Avatar for TrustyTony
0
133
Member Avatar for Tcll

hey guys... I just need a little help with my encoder... this is the problem: [Click Here](http://lh3.ggpht.com/-UC0gFCTBDM0/UE9xMsYt_sI/AAAAAAAAEBw/sCXGlO4XWRQ/s1280/float%2520to%2520bin.jpg) my code: def f(byte_size,value): e=((byte_size*8)-1)//(byte_size+1)+(byte_size>2)*byte_size//2 m,b=[((byte_size*8)-(1+e)), ~(~0 << e-1)] OS= '1' if value<0 else '0' #sign I,F=str(abs(value)).split('.') I=bin(int(I)).replace('0b','') FB='' l=0; r = int(''.join(['1']*e),2)+m while l<r: B,F=str(float('0.'+F)*2.).split('.') FB+=B if F=='0': break l+=1 #print FB …

Member Avatar for Tcll
0
223
Member Avatar for cruze098

Hi, this is my code: def items_string(items_list): """Convert a list of Id, number pairs into a string representation. items_string(list((str, int))) -> str """ result = [] for item_id, num in items_list: result.append("{0}:{1}".format(item_id, num)) return ','.join(result) class Compound(Item): def __init__(self,item_id,name,products,items_list): Item.__init__(self,item_id,name) self.products=products self.items_list=items_list def __repr__(self): self.items_list=items_string(self) return '{0},{1},{2}'.format(self.item_id,self.name,self.items_list) class Products: def …

Member Avatar for Gribouillis
0
383
Member Avatar for silvercats

IronPython (Python running on .NET) Jython (Python running on the Java Virtual Machine) PyPy (A fast python implementation with a JIT compiler) Stackless Python (Branch of CPython supporting microthreads) Do we have to write different codes for those different python implementations (aka compilers ,right?) http://python.org/download/ << If I download windows …

Member Avatar for Gribouillis
0
158
Member Avatar for mbh1992

#import libraries import random # #create empty list places = [] i = 0 # open file handle myfile = open ('places.csv') # Subsquentially read lines for line in myfile: row = line.strip().split(',') # first line of test if if i == 0: fields = row i = 1 else …

Member Avatar for mbh1992
0
851
Member Avatar for hotblink

Hi, newbie to python here, I just wanted to ask how I can compute the after tax price and displaying only up to 2 decimal places. Like 4.1895030939393 will display only 4.18 without it rounding. Here's what I've done so far Original_Price = float(input('Please input the before-tax price : ')) …

Member Avatar for TrustyTony
0
201
Member Avatar for maurya10
0
54
Member Avatar for giancan

Dear friends, I create a script to extract coordinate from the exif of a number of images and create an excel file with thumbnail, latitude, longitude and other columns. I was wondering if there was an (easy) way to find the closest placename from geonames given lat and long. Thanks, …

Member Avatar for M.S.
0
221
Member Avatar for jacarandatree

Hi, I am really new to python so please do not judge me! I want to install packages but couldnt do so. Here are the steps that I followed based on some web instructions, but I am making a mistake somewhere in the process. 1. I downloaded the setuptools 0.6c11 …

Member Avatar for Gribouillis
0
116
Member Avatar for zeeters

I have to write a program that takes a word from the user and replaces it if it is in the text file with another word given by the user. Then takes that input and writes it to a new file. The only problem is, I have to do it …

Member Avatar for zeeters
0
3K
Member Avatar for TrustyTony
Member Avatar for vegaseat
0
254
Member Avatar for krystosan

Hello I am trying to build a function that i can use in to search for an object or item from its name, Here is what I have in **sfind.py** def findobj(searchTxt,items): """ This function will help you find an object or an item from list of items passed to …

Member Avatar for krystosan
0
157
Member Avatar for mohsin.javaid.73

I am having a really weird problem. In my program I am using a tab widget and two pages on that tab widget. Both pages contain a wxListBox widget on them. I am using wxLB_EXTENDED with both of the List boxes. The problem is that the the ListBox on first …

Member Avatar for mohsin.javaid.73
0
209
Member Avatar for supravat

Hi, Suppose I have 3 bluetooth devices( device1, device2, device3) paired with my android phone. Is there any way to test whether the remote bluetooth device is turned on or not using python script ?

0
69
Member Avatar for supravat

Hi, I want the list of paired bluetooth device list of an android device using python script. can any one please help me ?

0
48
Member Avatar for tammy12w

so lets say you finished your program. you made the GUI and it runs fine. so everytime you want to run your program you have to go to python(or what ever you use) lauch it to see your program. my question is what code or what do you have to …

Member Avatar for TrustyTony
0
164
Member Avatar for M.S.

This is me with another project for beginners :) The Project as stated by ZZucker about 2 months ago: "Given the length of three sides, write a function that checks if it is possible to create a triangle." I could solve it with an annonymus function like this: is_triangle = …

Member Avatar for M.S.
0
253
Member Avatar for jakehardy

I need to read and write an XML file which may contain '€' symbols. So, to start I run this code: from xml.etree import ElementTree as ET optionstree = ET.parse("test.conf") where "test.conf" is the following XML file: <?xml version="1.0" encoding="UTF-8"?> <test>12€34</test> and I get this error: File "<pyshell#7>", line 1, …

Member Avatar for Gribouillis
0
318
Member Avatar for lancelot626

I've been trying to display sqlite data in wxcomboboxes but I get a type error not all arguments converted during string formatting, I'm Using a caller for the frame and it displays for about five comboBoxes but when I add more (exactly the same way as the first ones) It …

Member Avatar for lancelot626
0
300
Member Avatar for athulram

Hey all. I have this program where I need a variable number of for loops. For eg. the program i use to find the pythogorean triplets is for n1 in range(100): for n2 in range(100): for n3 in range(100): if n1**2+n2**2 == n3**2: print str(n1**2) + '+' + str(n2**2) + …

Member Avatar for athulram
0
4K
Member Avatar for sean.kallungal

I am trying to write a program in Python that converts user input from English to Pig Latin ("Y" is not a vowel in this case, breaks off at first vowel and moves preceding consonants to the end). The end product of my program should be able to compute whole …

Member Avatar for M.S.
0
678
Member Avatar for M.S.

This is and answer to one of the Vegaseat's recent projects for beginners. I share my solution here because -as a begginer and do learn python as a hobby- I need your feedback. So please tell me am I doing it the right way? Thanks in advance for comments from …

Member Avatar for M.S.
0
310
Member Avatar for PythonMonty

# convert2.py # PPython Monty # Lab 2 Ch 2, PE 4 # A program to convert temperatures from Celsius to Fahrenheit and # vice versa def main(): # description of program print("This program converts Celsius temperatures to Fahrenheit and") print("vice versa.") conversion = ("C") n = eval(input("How many temperatures …

Member Avatar for HiHe
0
797
Member Avatar for Patrick.Barklem

Hi there, im relatively new to python and i just can't figure out parameters... Any help with this code? def main(): getInputs() answer = calculateWork() print (answer) def getInputs(a,b): num1 = int(input("Please enter your first number: ")) num2 = int(input("Please enter your second number ")) return num1,num2 def calculateWork(): return …

Member Avatar for vegaseat
0
161
Member Avatar for pynehalem

To All Pythonist.. I have small SQLITE db.. for User Table 'SELECT loginUser from User'; sql = cursor.fetchall() listSQL = sql[:] for x in listSQL: print x listSQL SELECT Data Produce: (u'user1',) (u'user2',) (u'user3',) I want to match the list of user with a string input: example if the value …

Member Avatar for woooee
0
325
Member Avatar for ddree

An employee is paid at a rate of $20.75 per hour for regular hours worked in a week. Regular hours are up to and including 40 hours per week. Any hours in a week worked over regular hours are paid at the overtime rate of time and a half (i.e. …

Member Avatar for woooee
0
1K
Member Avatar for sainitin

I have 29 text files as follows File 1 12313 : 23546 12313 23214 32465 File 2 13132 : 23546 12323 32125 32125 32121 . . . I would like to have python script which computes intersection between these files ideal result as follow 12313 : 23546 13132 : 23546

Member Avatar for vegaseat
0
222
Member Avatar for hotblink

Hi there, newbie to python and in need of help for an assignment. I have to write a Python program that prompts the user to input the before-tax price of an item and the payment from the customer. It should then perform two tasks. First, compute and display the after-tax …

Member Avatar for Xantipius
0
442
Member Avatar for ejohnson

I downloaded Python 3.2.3 from the python.org web site. However, when I click to launch the python command line the initial message from windows is as follows: "Please waite while windows configures python 3.2.3. Using this link Python 3.2.3 Windows x86 MSI Installer (Windows binary -- does not include source) …

Member Avatar for vegaseat
0
503
Member Avatar for Amy_3

I am new to python. How to instantiate object from parsing a file? I got a error. File "/home/Bunny.py", line 23, in main mapgrid[i].append(Spot(myLine[j] == 'B')) TypeError: 'module' object is not callable The first line of input is the number of simulations. The next line isthe number of minutes for …

Member Avatar for Xantipius
0
280
Member Avatar for rmbrown09

Just a quick question, why does the first findall print out hello but the second just gives me brackets with nothing in them. I want it to show me everything that matched. Which in this case should be everything. k = "hello there how are you" print re.findall(r'hello',k) print re.findall(r'\w+',k)

Member Avatar for rmbrown09
0
61
Member Avatar for littleEuler

def main(): celsius = float(input("What is the Celsius temperature? ") fahrenheit = (9/5) * celsius + 32 print ("The temperature is ", fahrenheit, " degrees Fahrenheit.") main() error output: Syntax Error:(line 8) fahrenheit = (9/5) * celsius + 32 This makes perfect sense to me. How can i fix this …

Member Avatar for hughesadam_87
0
110
Member Avatar for mandroid

Hello all, first time poster here. I've tried searching for a thread which deals with my current problem both here and in Google, but few people seem to need help with PyFluidSynth as compared to Jack, so I am starting a new thread. If anyone knows of another thread where …

0
127

The End.