15,175 Topics

Member Avatar for
Member Avatar for karmstrong

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 …

Member Avatar for vegaseat
0
5K
Member Avatar for Shalu.23

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" …

Member Avatar for vegaseat
0
253
Member Avatar for G_S

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 …

Member Avatar for Gribouillis
0
520
Member Avatar for cjohnweb

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 …

Member Avatar for vegaseat
0
359
Member Avatar for Edward_6

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 <= …

Member Avatar for vegaseat
0
199
Member Avatar for FraidaL

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 …

Member Avatar for David W
0
138
Member Avatar for nuaris

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

Member Avatar for snippsat
-1
5K
Member Avatar for joshuawilson11

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, …

Member Avatar for joshuawilson11
0
188
Member Avatar for vegaseat

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 …

Member Avatar for MatthiasBl
3
19K
Member Avatar for AnthonyJbs

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 …

0
916
Member Avatar for Niloofar24

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 …

Member Avatar for vegaseat
0
438
Member Avatar for joshuawilson11

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

Member Avatar for vegaseat
0
137
Member Avatar for fatalaccidents

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 …

Member Avatar for fatalaccidents
0
2K
Member Avatar for joshuawilson11

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 …

Member Avatar for joshuawilson11
0
505
Member Avatar for Kristal_1

Can someone please give me an example code for a tkinker GUI of a reverse polish notation calculator written in python.

0
150
Member Avatar for jeffcogswell

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#. …

Member Avatar for Tcll
3
2K
Member Avatar for BustACode

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 …

0
337
Member Avatar for Ragunath_1

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 …

Member Avatar for vegaseat
0
67
Member Avatar for Niloofar24

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, …

Member Avatar for vegaseat
0
589
Member Avatar for Niloofar24

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 …

Member Avatar for vegaseat
0
491
Member Avatar for CodeWarrior14

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 …

Member Avatar for vegaseat
0
350
Member Avatar for vegaseat

We have had several snippets on the format() function. This one gives a condensed overview of the many options you have.

Member Avatar for BustACode
6
928
Member Avatar for CodeWarrior14

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 …

Member Avatar for vegaseat
0
371
Member Avatar for Mate_1

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!

Member Avatar for vegaseat
0
981
Member Avatar for linus72982

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 …

Member Avatar for vegaseat
0
256
Member Avatar for renierdbruyn

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 += …

Member Avatar for Schol-R-LEA
0
354
Member Avatar for vegaseat

A very basic pygame sprite example. Moving a sprite with the arrow keys, could be the start of a great space game.

0
6K
Member Avatar for BustACode

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 …

Member Avatar for vegaseat
1
328
Member Avatar for BustACode

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.

Member Avatar for vegaseat
0
452
Member Avatar for BustACode

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 …

Member Avatar for vegaseat
0
373

The End.