15,175 Topics
| |
In python if I know the volume label of a USB mass storage device is there a way to get its. Drive letter Windows Mount Point Linux Mount Point OSX Originally I was thinking either the sys library or the os library. i ahve found another library called PYUSB. Still … | |
how to dynamically insert keys into an existing python dictionary, input is the .json file and the output in a .csv file. this is the input in the .json file [{"FIRSTNAME":"barc","EMAIL":"jahg@jh.com","ADDRESS":"gyuyj"}, {"FIRSTNAME":"rth","EMAIL":"tht@thuyj.com","ADDRESS":"ytju"}, {"FIRSTNAME":"trhy","EMAIL":"klo@pyu.com","ADDRESS":"trght"}, {"FIRSTNAME":"ghy","EMAIL":"ytj@uki.com","ADDRESS":"ukyk"}] output is required as .csv file(in each row its specified columns should be added) "FIRSTNAME":"barc","rth","trhy","ghy" "EMAIL":"jahg@jh.com","tht@thuyj.com","klo@pyu.com","ytj@uki.com" … | |
Hello everyone. I am currently making some database connection modules in Python inb order to learn Python's approach to OOP and also to lear how to connect to databases via Python. I successfully made a package with modules for postgres, mysql, sqlite3, and MongoDB. The classes simply connect, disconnect and … | |
Hello! I'm working on a program at work for a device we are building, it's a device that (basically) in real-time reads in sensors, makes decisions about said data, and performs output. I have a loop that runs, and then calculates how long to sleep, so we can get as … | |
def main(): print ("-------------------------") print ("Program computes your BMI") print ("-------------------------") while weight == float(input("Enter weight in pounds: ")) while height == float(input("Enter height in inches: ")) if weight <= 0 or weight > 500: print ("Weight cannot be less than 0 or greater than 500") continue elif height <= … | |
A few months ago someone figured out how much money to put on a metrocard so that you end up with a zero balance instead of random amounts on your balance that you need to figure out how to even out or just throw away and lose that money. Now … | |
How do I read a .txt/.csv file from an internet address? For example: http:\\[url]www.internetaddress.com\file.txt[/url] I don't think file() would work for this. Thanks | |
hi, soat the moment i am writing an encryption program, i am not quite sure how to use for loops for lists, my list at the moment is this: **Somewhere in la Mancha, in a place whose name I do not care to remember, a gentleman lived not long ago, … | |
The Tkinter GUI toolkit's canvas object is very nice for all sorts of drawings and plotting. However, when it comes to saving the image Tkinter limits you to postscript printer files. One solution is to draw the same image in parallel on PIL's image-draw object in memory. This is made … | |
Hello, I have created pretty simple voice chat with pyaudio, but the voice is kinda meh. You hear usually some noise like in the old movies. It is probably caused by missing CHUNKs of voice which I send over UDP. Is it possible to somehow reduce the noise? Further I … | |
Hello. I was looking for a tutorial or any example of creating web crawler that i found this code somewhere and copied and pasted to test it: First, it is a web crawler, right? Because when i gave it a url of a website, the output was some linkes were … | |
Hi so in my list i have multiple characters - '32' which i need to replace with a space, would anybody be able to give an example of how to do this? Thanks | |
Hello all, I'm hoping this is related enough to python to merit being posted here. I'm hoping someone will possibly have a better way of doing it altogether. I'm using tetgen to try to create a hollow dome. I was using triangle and then just triangulating a circle and raising … | |
Hi,so I am supposed to encrypt a text file chosen by a user at the moment I have completed most of it (offset factor/shift), I have got each separate character from the text file and put it into a list and converted it into ASCII, I am wondering how you … | |
Can someone please give me an example code for a tkinker GUI of a reverse polish notation calculator written in python. | |
People who know me know that Python has always been one of my favorite languages. And over the years, I've been pleased with the array of development tools that have been created for it, including the different IDEs. I also do a lot of work in .NET, primarily with C#. … | |
I just love generators in Python. One of the cool things I found out from [this](http://nedbatchelder.com/text/iter.html) site was that one could send in a value when calling on an active generator. To do so one uses the send() method and a yield like so: "x = yield". The send with … | |
I want to automate an application developed in java and swing controls using python. I tried pywinauto but it is not able to detect java objects. I tried using QTP but my applications dynamic java windows dosen't hava parent window so not able to use it . Any suggestion of … | |
Hello my friends. Look at this please: >>> from bs4 import BeautifulSoup >>> import urllib2 >>> url = urllib2.urlopen('https://duckduckgo.com/?q=3D&t=canonical&ia=meanings') >>> soup = BeautifulSoup(url) >>> links = soup('a') >>> print links [<a class="header__logo-wrap" href="/?t=canonical" tabindex="-1"><span class="header__logo">DuckDuckGo</span></a>, <a class="search__dropdown" href="javascript:;" id="search_dropdown" tabindex="4"></a>, <a href="https://duckduckgo.com/html/?q=3D">here</a>] >>> I used this `https://duckduckgo.com/?q=3D&t=canonical&ia=meanings` as the url, … | |
Hello! How can ask my scipt to print **every word** in a url page that starts with the letter "A" in this case? This is my code: from bs4 import BeautifulSoup import urllib2 url = 'http://www.thefamouspeople.com/singers.php' html = urllib2.urlopen(url).read() soup = BeautifulSoup(html) for word in soup.text: if soup.text.startswith('A'): print soup.text … | |
I have written a simple message encoded that encodes messages into words of 4 characters each. It generates a key that will later be used to decode the message. The key is a list of numbers. The numbers are the original whitespace positions before the encoding started. The problem: My … | |
We have had several snippets on the format() function. This one gives a condensed overview of the many options you have. | |
Hello. I am was doing research on cryptography and found a simple algorithm (One time pad algorithm) that interests me. I was able to create a simple version of this that only works with capital letters. The problem however is that the encrypted contents doesn't only contain capital letters. It … | |
Hi guys, I'm stuck on this. I'm trying to draw 2 triangles in Turtle (not what you think). I'm trying to get it to look like this: http://gyazo.com/5abdd3bc05a44945f1a74286e2ad43c6 What I have: http://gyazo.com/65357ea5d43a7dc49e89879a27e980b4 Code: forward(200) left(120) forward(200) left(120) forward(200) right(120) hideturtle() done() Any help is greatly appreciated! | |
I have a layout for an app that has a panel that places 3 static boxes (nodes) per row, and then keeps going until the dictionary of nodes is out. I figured out the flex grid sizer to do so (wrapped by regular boxsizers to add padding above and on … | |
I need to submit a form on which there is a group of inputs(that can be dynamically generated) that needs to be an array of objects(list of dictionaries). I Dynamically generate the following item when a button is clicked on the form: var count = 0 $("#add-order-item").on("click", function(){ count += … | |
A very basic pygame sprite example. Moving a sprite with the arrow keys, could be the start of a great space game. | |
As a result of my research in number theory I find that I often need to break a number down into its numerical parts while stepping through one divisor to another. I call this process "break factoring," as I am just breaking a number down into parts, and not necessarily … | |
Also because of my work in number theory, I often need to have the root floor and root ceing of a number. This is my function for computing those two numbers from a target number. | |
I do a lot of work in number theory, especially with factors. I often need just the two middle factors from a very long factor list/result, so I created a function that takes a factor list and returns just the middle two, or one, factors. Nothing earth shattering, but I … |
The End.