15,406 Topics
![]() | |
When I open python I am unable write my code in it. This just started to happen no idea what is happening? Its unclickable inside but I can click the bar on top. Anybody know? | |
I would like to embed the python interpreter, but not in the way most other people do. I don't need to multi-thread unless it's necessary to do as follows... What I need is control over when execution happens. More specifically, I would like to use a python script to call … | |
Hello, I am very new to python. I have two files containing multiple lines of files name, and I need to filter out if file name present on file1 than remove it from file2 and save the file2 difference into a third file. i.e. file1: /users/ux454500/radpres.tar /paci/ucb/ux453039/source/amr.12.20.2002.tar~ /paci/ucb/ux453039/source/amr.1.25.2003.htar.idx /paci/ucb/ux453039/source/amr.1.18.2003.htar.idx file2: … | |
i am beginning to learn python so please be easy on me, i am trying to create a function that will accept user input and store it in a list, separating words and ignoring punctuation example: input = i.am/lost stores in list as "[i],[am][lost]" this is what i got so … | |
Say I have a string of arbitrary letters and spaces. "fdgdfg asd fasdf asdf awpoemp poanew awe pon pqonw aknlkn ar glknlk and so on" is there any way to wrap this WITHOUT using the worp wrap feature so that there are only x characters in each line? "fdgdfg asd … | |
Write and test a function to meet this specification: squareEach(nums) nums is a LIST of numbers. Modifies the list by squaring each entry. [CODE]def squareEach(nums): for number in nums: number = number ** 2 return number def main(): nums = [3,4] print(squareEach(nums)) main()[/CODE] The output in this case is 9... … | |
hi am an btech CS student. I need some ideas for my main project.. need help donno where to start..guyz plz help | |
Dear ALL, I have a similar problem with a string/replacement 132435 321350 35465162 6561516 546516 654613 65462133 6584652 and so on for some hundreds (!!) raws. What is the best way to edit this textfile to have something like this? 132435,-321350,35465162,-6561516 546516,-654613,65462133,-6584652 Basically, I have to change the 'double space' … | |
Hi all, I have two text files file1 1234 13454 93837 82739 . . . File2 comp i 93837 -4.52 82739 -2.2 1234 -2.36 13454 -2.25 I tried a python script to compare files and it should ideally do following search CID from file1 in file2 and append i value … | |
Hey guys, new to the forum, but am in need of some help. I am quite new to Python, but want to be able to program a simple script that basically does three things: -1. Finds a string of text in an .xml file (the length of the string, and … | |
[CODE]def toNumbers(strList): for char in strList: return strList[0:len(char)] def main(): sttr = ['120','125'] print(toNumbers(sttr)) main() [/CODE] The output is: ['120','125'] I want the output to read: 120 125 <-- without the brackets and quotes I'm supposed to take a list of numbers (as strings) and simply return the same numbers … | |
Hi, I'm a beginner at python and I'm trying to extract a specific column from a txt file. In the file I want to extract the entire column pph2_prob (i.e. column 16). But I want to get all the values from that column without the headline pph2_prob. How do I … | |
I would like to know how to use a list contain with file names returned from a function to search a directory based on that list then copy the matching files to another directory. Following is what I would like to accomplish in logical order. 1. Existing Function getPromptList() return … | |
What is the best way to invoke the os.system command and assign it to a variable without printing the output ? Example : [CODE]ifName = os.system('snmpwalk -v 1 -c <community> %s ifName.%s' % (switch,port))[/CODE] Also with the output of the snmpwalk I will be wanting to only assign the last … | |
Hi everyone, I have a huge data file and it goes on like this. [CODE] 62813, 61344, 68229, 68234, 61349, 61345, 68230 62814, 61345, 68230, 68235, 61350, 61346, 68231 62815, 61346, 68231, 68236, 61351, 61347, 68232 62816, 61347, 68232, 68237, 61352, 51631, 51573 *ELEMENT,TYPE=S4,ELSET=one 62817, 1, 2, 4, 3 62818, … | |
How I can generate reports in pdf in python print screen to print? | |
I know I just listed an earlier problem I had with the encoder program, but now I am having trouble placing the decoding formula into the decoding program. In the program you will see that I have the normal decoder for the ASCII characters in there. everytime I try to … | |
i am making winter greeting card using grahics.py and i need to create a code to make it snow import random random.randint(0,199) p = Point(random.randint(0,199),random.randint(0,199)) p.setFill('white') p.draw(win) so far that what i have but noting really happened please help ! thanks ! | |
I am trying to do this simple encoding program for class. It is supposed to encode it using the ASCII chart and some slight modding of the number. Then it should be written to a file 'encryptedmessage.txt' for later reading by a decoder later. My issue is I dont know … | |
Im working on python and I need to write a program to see if a number N is prime. I also need it to be able to check whether the number is even, and then, check whether the number is divisible by an odd number between 3 and &radic&N. Im … | |
hi , I need use the python language write code (I must use below packeges) 1.python-2.6.6 2.nltk-2.0b9.win32 3.numpy-1.6.1-win32-superpack-python2.6 4.PyYAML-3.09.win32-py2.6 and I am already write a code all code are normal. my current problem is : I need to develop windows application use these packages, there are some IDEs like SharpDevelop,ironpythonstudio … | |
I have an app I wrote in Python/wxPython. When I click a button, the action that is taken will depend on whether or not a modifier key (such as CTRL) is currently pressed. I can't toggle a swich based on a keypress event (eg ctrldown = True or False) because … | |
Here unsystematic play with linked list structure Object Oriented style. If you have performance critical code, please do not use this but use the superb faster than list [URL="http://pypi.python.org/pypi/blist/"]blist module[/URL] (including sorted versions of main data structures). As OO newbie (though with some 30 years of other programming), I wanted … | |
Use the Node class. Create a tester module that contains the following function definitions and code for testing them. The function definitions are: 1. A function length (not len) that expects a single linked structure as argument. The function returns the number of items in the structure. 2. Define a … | |
Hello All I'm not quite sure you can do this but it seems to me like something python is probably able to do. Basically, I need to assert that somewhere in my list of lists i have a '2', and a '1'. Now my lists in the biglist are all … | |
Does anybody know how to clear all widgets; labels, buttons, etc. from a tkinter frame so that new ones may be put in their place? I've tried self.destroy() but that makes the frame unreachable, and self.grid_forget() followed by, "and without" self.grid() neither of these work, at least not as expected. … | |
[CODE]# phonebook dictionary phonebook={'francis':'francis@gmail.com','iris': 'iris@gmail.com','karen':'karen@gmail.com'} name=raw_input('what name you want to check :') # check if the name is in the dictionary if name in phonebook.items() : name=key print phonebook.get(key) # if yes, print the email else: print 'not here' # check the correctness of the program # I could not … | |
I wrote the following code in Python. It does not sort the list. Can anyone help me out? [CODE] theList = [] def simpleSort(): pos = 1 comps = 0 while pos < len(theList): comps += 1 if ord(theList[pos]) >= ord(theList[pos - 1]): pos += 1 else: temp = theList[pos] … | |
I am having trouble with a python homework question. The problem is the following: You are to write a program that counts the frequencies of each word in a text file (text.in), and outputs each word with its count to a file (word.out). Here a word is defined as a … | |
I have a list of numbers, and for each value in the list, I need to compute something based off of that value and the previous 7 values. I'm sure there is an easy bit of code to do this, but I am just at a loss right now. For … | |
Hi all, I'm working on this problem where I want to get a dictionary list of all tree species with the count. That part has been worked out. With in the for loop for tree species, I also want to get the sum of DBH (diameter breast height) for each … | |
I am encountering the error attached "UnicodeEncodeError: ASCII codec can't encode character u'\0152' in position 124: ordinal not in range(128)" Please help me solve this..... | |
I've just started Python and need to write a program that tells if a string is a palindrome. Here is what I have so far. [CODE] def palp(word): if len(word) < 2: return True left_index = (0) right_index = len(word) - 1 while len(left_index) <> len(right_index): return False if left_index … | |
Not received any RSS updates from Python group since 22 September. RSS feeder reports an "error" will try again. Other Daniweb RSS feeds working fine. | |
![]() | Hey, so i want to make a funktion that prints all the words from a list (words.txt) that doesn't contain the letter e. I tried something like this: [CODE]def has_no_e2(word): fin = open('words.txt') for line in fin: word = line.strip() if letter in word: letter == ('e') print(word)[/CODE] But i … |
I'm completely new to Python and unsure how to run this script. The script is to take in an image folder and for each image, if the size isn't a power of 2, it will add "paddings" to it to make sure it's a power of 2. (These pictures are … | |
import math def board_gen(width, height): height = int(height) width = int(width) xo = ['O','X','O','X','O','X','O','X','O'] strt_ltr = 1 board = [] for row in range(1, (height+1)): strt_ltr = int(math.sqrt((strt_ltr-1)**2)) line = xo[strt_ltr:(width+strt_ltr)] board.append(line) return board config = ['O','X','O','X','O','X','O','X','O'] if (height%2==True): print config[0:width] else: print config[1:width] I do not know where to … | |
Hello Friends... Basically i am a Freelance Web Developer with extensive experience in design & development using Ruby on Rails, Python, PHP, Flex, Django and Drupal including complex Python ,Django/Postgress bug Rectification, Android and i OS development Also I am doing experiments in HTML5, Scala,Haskell and Erlang. Recently Twitter had … | |
OS: Win7x64 6.1.7601 py: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] I was able to create a logging class that posts to a file; however, despite reading several tutorials and the traceback docs from python.org, and creating a 'handleError' method, I'm unable to get my code … | |
I am trying to create a python program but i have a question about a certain part of the loop for example i have [CODE] question = input("press 1 or 2") if statement == 1: print "somthing" elif statement == 2: print "abc" [/CODE] ok my question now is for … | |
As most of us know in tkinter in order to properly display an image it must be assigned to a variable, however what if you don't know that amount of images that are going to be necessary? i.e. A friend list, how would one display the friends pictures? | |
I'm trying to utilize partial in order to bind an image to it's associated name in a list "you'll see what I mean" but I'm getting a TypeError thrown on it, this is my first time trying to work with partials so I'm just not quite sure what's going on: … | |
Hello! I didn't read the rules or anything, so I don't know if I'm posting in the right place, but I need help with a program as soon as possible. I have to answer this question: Find the first ORF in a sequence from a position (findORF(DNA, position)). It must … | |
I have to take ascii values from characters in a paragraph and make them print like: 116 = t = (# of times it appears) i have everything printing right except for the number of times it appears. I don't know what I am doing wrong with this counter. any … | |
here is my code: [CODE]conbi = ['a1','b1','c3','c4','f7'] left_unmatched = 5 wrongtimes = 0 right = 0 guess = input('Shoot: ').split(' ') guess = list (guess) for i in range(len(guess)): if guess[i] in conbi: left_unmatched -=1 right +=1 print ('Hit:',right,'Missed: ',left_unmatched) print ('Hit:',right,'Missed: ',left_unmatched)[/CODE] when I enter a1 b1 c3 c4 … | |
Can someone help me convert the following C++ code to python, please. I am fairly new to python. [CODE]void main() { int i,j,cnt,l,count[50]= {0}; char str[50]; clrscr(); printf("Enter the string: "); scanf("%s",str); printf("\n\tOriginal String is: %s",str); printf("\n\n\tEncoded String is: "); l = strlen(str); for(i=0; i< l; i*=1) { j = … | |
Hi, I have this code to communicate to an RFID device that outputs hex values. [CODE]import serial COMPort='COM13' mySer=serial.Serial(COMPort, 9600, timeout=2) try: mySer.flushInput() print "".join(["0x%2x " %(ord(c)) for c in list(mySer.readall)]) print msg finally: print 'Close' mySer.close()[/CODE] but cause error [ICODE]Traceback (most recent call last): File "C:\Python26\rfidtest.py", line 6, in … | |
I am Making A program for malking a phonebook. for that i am storing a list in dictionary. Like this: [code] phbuk={} def add(): a=raw_input('Name :') b=raw_input('Email :') c=raw_input('Mobile :') name=[a,b,c] d=len(phbuk) phbuk[d+1]=name [/code] Now if i want to delete a particular record just by giving name then how can … | |
hi, i am interested how is possible to work with python from dos and if somebody have some simple example. | |
From a thread on another forum, I wondered how difficult it would be to create a Tic-Tac-Toe game that could not be beaten. Since it is easiest if the computer goes first and chooses the center square, this code implements that portion. The logic is fairly simple; occupy the center … |
The End.