15,181 Topics
| |
hello sir, my work is run version.sh file and collect the values of version and type in the output. i have around 500 servers,so i want to automate this process using pyhton. i had written sample code shown below, but it is not giving good results.will you please help me … | |
#!/usr/bin/python3 import sys input1 = sys.argv[1] def print_params(*params): print(params) print_params(input1) #END# In the above code how can I call all the command line arguments with the prin_params function without having to code input1, input2, input3, etc... When I'm doing testing liket this I would like to be able to just … | |
Hi All, I am trying to scrape a piece of HTML similar to the below where I want beautiful soup to return something like: List Price, £28,410 Body Style, Open Car etc etc. I thought if I did this: soup = BeautifulSoup(html_doc) tag = soup.find_all('tr') tag_td = tag[0].find('td') tag_b = … | |
I'm curious.. is it possible to extend the context of the word "monstrous" in concordance so we have: >>> text1.concordance("monstrous") Building index... Displaying 11 of 11 matches: ong the former , one was of a most monstrous size . ... This came towards us , ON OF THE PSALMS . … | |
Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and the display the following data: • The lowest number in the array • The highest number in the array • The total of the numbers in … | |
I'm trying to modify a Bibblesort code I'm writing that will count the number of instances and print out a seperate line for each instance and how many occurances it had. def BubbleSortList(MyList): ComparisonCounter = 0 for j in range ( len(MyList)): for i in range ( len(MyList)-1-j ): if … | |
Hi, I'm trying to teach myself the Python language with the Google Python class ([url]http://code.google.com/edu/languages/google-python-class/set-up.html[/url]). With the exercise 'wordcount' I get a Traceback error (with the main function and sys.exit(1) function). Even with the solution script (as displayed here). Does anyone recognize this problem and can some one tell me … | |
How do I rotate image in this code every n seconds http://pastebin.com/SKDzuC15 lets say i want to change the image in pixmap after 5 seconds to next image, what is happening right now the last one gets displayed. | |
I started this for any information on new python modules apart from standard library. Many people (Including me), aren't willing to move into p3k due to lack of external/non-standard modules. So I started this to keep ourselves informed on New Python 3 Modules. No Limitation, ANY PYTHON 3 MODULE | |
I need help with the button action for this code. When you click on the button, a new window should open with the GIF image of the horoscope sign. The name of the GIF image files are "Pisces.gif", "Taurus.gif",etc. from Tkinter import * #Call all modules for TKinter in order … | |
Just a simple image file slide show using PySide (PyQT). | |
Programming Python 3rd Edition by Mark Lutz has example code (below) where a variable seems to be assigned with options ("or") but what the criteria for selecting the options is not clear. The explanation is almost non-existent but I think this is to do with feeding in a variable number … | |
Hello! I am a newbe to python and apologize in advance for this question, because I am sure it is an easy fix that I am oblivious too - I wrote this simple program for a guessing game- very basic, which is fine - but when you get to the … | |
Hi there, I am a newbie in programming. Python is my choice. because it is easy to learn. But the Tkinter GUI making is horiible. I don't like to write code for GUI. I like the visual basic method. So i installed Qt Designer. But i don't know how to … | |
Maybe a list comprehsnion is not the right way to go here. I want to define a nested list that a user can tell how many lists and how many entries in each subllist. Then have random call a value for each entry in the sublist, working on unique entries … | |
I'm new to Python, but I can use a library to do this, right? Like this one: import pprint import scipy import scipy.linalg # SciPy Linear Algebra Library A = scipy.array([ [7, 3, -1, 2], [3, 8, 1, -4], [-1, 1, 4, -1], [2, -4, -1, 6] ]) P, L, … | |
Hi I am struggling with assigning values to a list of a list. This is my full code. import random #get user input as to size of range range_size = 0 if range_size == 0: try: range_size = int(input('Size of Range?: ')) except ValueError: print('That was not an integer!') range_size … | |
Can someone please help me with this because it is driving me crazy. I wrote a program which prompts the user to enter a number I convert the string to an integer when i print the value it sometimes comes out as a decimal e.g. 3.0 I thought an integer … | |
# This is my code for a space invaders-like game in pygame. How do I add a second enemy? # from pygame import * import random class Sprite: def __init__(self, xpos, ypos, filename): self.x = xpos self.y = ypos self.bitmap = image.load(filename) self.bitmap.set_colorkey((0,0,0)) def set_position(self, xpos, ypos): self.x = xpos … | |
I have been trying to find the frequency distribution of nouns in a given sentence. If I do this: text = "This ball is blue, small and extraordinary. Like no other ball." token_text= nltk.word_tokenize(text) tagged_sent = nltk.pos_tag(token_text) nouns= [] for word,pos in tagged_sent: if pos in ['NN',"NNP"]: nouns.append(word) freq_nouns=nltk.FreqDist(nouns) print … | |
Note: this isn't a questional thread. I need help in building an accurate and efficient Vector class which supports 1D to 4D vectors with their various manipulation/transformation methods. in the end, I want the result to be a reference for other users to copy from. this class is not meant … | |
I have to append first 3 sentences of this sample text to a file(data.txt). So far I've done this: import nltk text="""First patented in 1876 by Alexander Graham Bell and further developed by many others, the telephone was the first device in history that enabled people to talk directly with … | |
Hello, When i try to insert some datas with python to MySQL database where the fourth column is a variable , (it depends on the variable "e0") , i get a message error here is the query syntax : `cur.execute('insert into suiviactuelms (modelsa,date,heure,%s) values (%s,%s,%s,%s);',(e0, modelidvar, cur_date, t, quantitevar))` and … | |
I'm pretty new to coding with Python and I am trying to save a users username in a session variable which should be a new entry in the session dictionary. The code I have is from bottle import route, request, debug, run, template session={'logins':0} def checkLogin(name,password): if name==password: return True … | |
Hi, I am new to Python and am looking into web development frameworks i.e. Pyramid. Is there anyone here who is familiar with this Framework using MongoDB? I am using pymongo and Ming I follwed a tutorial [here](http://pieceofpy.com/2012/01/10/working-with-pyramid-and-ming/). I am getting an `AttributeError: 'str' object has no attribute '_auto_ensure_indexes'` in … | |
Are there any built in modules in python 3.3.0 that can handle images? | |
Here little debugged version of my calculator posted earlier in GUI calculator thread. I prepared it after listening that their teacher did more limited calculator in around 150 lines of code with their graphics module. This is 115 lines without empty lines and comment lines [CODE]>>> li=[i for i in … | |
hello, I want to compare 2 strings.I want to find if a list with characters contains all the letters in a string. If **all** the letters in the string are in the list. For example: > mystring='abc' > mylist=['a','b','c'] must return True > > mystring='abc' > mylist=['a','c','b'] must return True … | |
ok guys I really need help with this homework assignment that my teacher sent I really dont know where to start a little help will be great. You are to write a program that will compute grades. Its input will be a file containing semester scores in TAB-separated format as … | |
# Heading Here #Hello ## I am reading a book that doesn't do a very good job of explaining things. It is talking about parallel arrays and gives an example of pseudo-code. I am trying to figure out how to access the parallel arrays using python and I wrote this … |
The End.