15,190 Topics
![]() | |
!USING PYTHON 3.1! Hello DaniWeb! Today I'm going to teach you a cool variable trick that I learned. So here's an example: [CODE] a, b, c = input('?x?x?: ').split('x') [/CODE] Now let's input something like: [CODE] >>> a, b, c = input('?x?x?: ').split('x') ?x?x?: 1x2x3 [/CODE] Now, variable 'a' is … ![]() | |
Hello, I have used geopy module for my school project. Today, I run my code but an error occurred error was: geopy.exc.GeocoderServiceError: HTTP Error 500: Internal Server Error it occurred at geolocator = Nominatim() location = geolocator.reverse(pr, timeout = 20) before a few days, my code worked well, so I … | |
Good Afternoon: I would like to have this JSON object written out to a CSV file so that the keys are header fields (for each of the columns) and the values are values that are associated with each header field. Is there a best practice for working with this? Ideally … | |
Hello I am new to Python and I have a question for a simple piece of code as below: temp = '32' if temp > 85: print "Hot" elif temp > 62: print "Comfortable" else: print "Cold" According to my understanding, when the program compiles and goes to line 2, … | |
records = [ ('foo',1,2), ('bar','hello'), ('foo',3,4), ] def do_foo(x,y): print 'foo\t{0}{1}'.format(x,y) def do_bar(s): print 'bar\t{0}'.format(s) for tag , *args in records: if tag == 'foo': do_foo(*args) elif tag == 'bar': do_bar(*args) when i run the above program , i get invalid syntax .I dono why this happens? Can someone help … | |
Here lambda is used to create a one-line function for factorials. | |
It's been a year now since the Dyre malware family was first profiled, and there is no sign of infection rates slowing down. In fact, [reports](http://www.scmagazine.com/trend-micro-documents-new-malware-infections/article/418266/) would seem to suggest just the opposite with infections up from 4,000 at the end of last year to 9,000 at the start of … | |
10x^6+3x^5+4x^+4 9x^6+2x^4+2x+5 1)could you please propose a suitable data structure to store above ploynomials. 2) and, how to add & multiply them using python codes. | |
i've been working on a testproject as part of my django learning experience.now, the project is such that a client registers itself on the application and similarly a contractor can also register itself separately..now, the client can have many projects and in those projects, a project can have many contractors … | |
Hello, I made some code using Pydev, python. codes worked well and resulted good. but when I run it on the raspberryPi, errors occurred and it didn't work well. Of course, I couldn't get proper results.. print ser.readline() AttributeError: 'int' object has no attribute 'readline' File "gpste.py", line 103, in … | |
Needed a func to convert base 2 into 10, and back. Found the referenced code in this func for moving between three bases, and generalized it to between bases 2 and 62, and all in between. Upconvert a number, then down convert, then upconvert again. Go wild, have fun. | |
I've been here before but I'm looking to find a single-pass method to input the LRS `[[0,0,0],[0,0,0],[1,1,1]]` and get a basic 3x4 (at least) matrix in return: [ [1,0,0,0], [0,1,0,0], [0,0,1,0] ] ^ matrix is NOT transposed (I'll never understand why we use column-major) anyone got anything on this?? > … | |
There are totally 6 bam files. In that: 1,2,3 are one group 4,5,6 are in other group do.call([cfg.tool_cmd("cuffdiff"), "-p", str(cfg.project["analysis"]["threads"]), "-b", str(cfg.project["genome"]["fasta"]), "-u", cfg.project["experiment"]["merged"], "-L", "%s,%s" % (str(cfg.project["phenotype"][0])[2:8],str(cfg.project["phenotype"][1])[2:7]), "-o", output_folder] + [cfg.project["samples"][0]["files"]["bam"]] + [cfg.project["samples"][1]["files"]["bam"]] In this call: [cfg.project["samples"][0]["files"]["bam"]] should take 1,2,3 (first group) bam files. [cfg.project["samples"][1]["files"]["bam"]] should take 4,5,6 (Second … | |
analysis: clip_adapters: false differential_expression: comparisons: - condition1: embryo condition2: larva metadata: phenotype metadata: phenotype: embryo: - SAMN00990702-1 - SAMN00990702-2 - SAMN00990702-3 larva: - SAMN00990703-1 - SAMN00990703-2 - SAMN00990703-3 samples: - files: bam: pipeline/SAMN00990702-1/mappings/accepted_hits.bam name: SAMN00990702-1 output_folder: pipeline/SAMN00990702-1 - files: bam: pipeline/SAMN00990702-2/mappings/accepted_hits.bam name: SAMN00990702-2 output_folder: pipeline/SAMN00990702-2 - files: bam: pipeline/SAMN00990702-3/mappings/accepted_hits.bam name: … | |
Can somebody help me to convert markdown to html using python language. I'm not a programmer but i want to understand some basic things in programming, and now i'm trying to make this conversion. Can somebody show me for example how to convert this: https://gist.githubusercontent.com/Irene26/6da8be01b46f07bf2a48/raw/6ef8e49a7c50e0aa1ae7465f6069f0a262b0ad84/gistfile1.txt to look like this: https://gist.githubusercontent.com/Irene26/a05c52826fcd680cbd74/raw/22a44879753b137e28d25affefa21912dfdb6912/gistfile1.txt … | |
from gimpfu import * def do_message_box(msg): handler = pdb.gimp_message_get_handler() pdb.gimp_message_set_handler(MESSAGE_BOX) #{ MESSAGE-BOX (0), CONSOLE (1), ERROR-CONSOLE (2) } pdb.gimp_message(msg) pdb.gimp_message_set_handler(handler) def add_steg_text(image, layer, text): length = len(text) # limit length of message to 255 if length > 255: do_message_box("text too long! (don't exeed 255 characters)") return pdb.gimp_image_undo_group_start(image) newlayer = layer.copy() … | |
The following lower case letters are written partly below the **baseline: g, j, p, q, y.** We say that these letters have a descender. Write a function named hasDescender() that returns a list of those words in a string in which at least one letter has a descender. A word … | |
how would you work out speed between two sensors which is 500m apart. using speed=distance/time. when the car enters the first sensor say the time was 3:00 58 seconds. and the second sensor is 3:01 26 seconds. then the difference between the times ill be used in the formula, so … | |
from collections import deque def search(lines,pattern,history=5): previous_lines = deque(maxlen=history) for line in lines: if pattern in line: yield line,previous_lines previous_lines.append(line) if __name__ == "__main__": with open('history') as f: for line,prevlines in search(f,'python',5): for pline in prevlines: print( pline , end ='') print('-' * 20) Can someone help me to understand … | |
I am trying to create a GUI using Tkinter, that reads in serial data. I eventually want multiple check buttons (for each possible port), and when the checkbutton is clicked, I would like the raw data from the port to continuously print onto a textbox in the GUI. I did … | |
I want to know addresses of some coordinates, so I use geopy-1.10. my code is from geopy.geocoders import Nominatim def to_degrees(lats, longs): lat_deg = lats[0:2] lat_mins = lats[2:4] lat_secs = int(lats[5:])*60/10000 lat_msecs = int(lats[5:])*60%10000 lat_str = lat_deg + u'.'+ lat_mins + str(lat_secs) + str(lat_msecs) lon_deg = longs[0:3] lon_mins = longs[3:5] … | |
Hello, I want to know addresses of some coordinates, so I use geopy. my code is from geopy.geocoders import Nominatim def to_degrees(lats, longs): lat_deg = lats[0:2] lat_mins = lats[2:4] lat_secs = int(lats[5:])*60/10000 lat_msecs = int(lats[5:])*60%10000 lat_str = lat_deg + u'.'+ lat_mins + str(lat_secs) + str(lat_msecs) lon_deg = longs[0:3] lon_mins = … | |
This is kinda a poll. Please reply, and answer the 2 questions shortly, so I can get a grasp of your feedback. I want to know if there is a desire for this, or if it already exists. Years ago I started to work on a python program called "spellcheck-dir" … | |
Hello, I'm trying to make timer which spit out gps signal every 10 or 60 seconds. here is my code. * **import threading import time import serial import datetime, string from pynmea import nmea def init_serial(): COMNUM = 13 global ser ser = serial.Serial() ser.baudrate = 9600 ser.port = 12 … | |
ok, so I'm trying to basically load a dll that can be under multiple names: - freetype6 - libfreetype-6 and more I don't want it to find freetype.dll (I want it to search for 'freetype' and '6') how can I load a dll with a regex from the system paths?? … | |
A strange phenomenon! What is this number 8! We are in the 2.7 version of Python. **MY CODE ** x = raw_input("write a list! utilisation of raw_input ") y = input("write a list! utilisation of input ") print x, "resultat of rawinputation" print y, "resultat of inputation" **My input and … | |
hey everyone im making a program that takes a number (n) from the user and then decides if it is prime or not and prints that decision to the screen [CODE] from math import * def main(): n=eval(input("please enter the number you wish to check:")) n=abs(n) if n < 2: … | |
**Part A.** Define a function triangle that draws an equilateral triangle and takes two parameters: 1. t, a turtle object 2. size, the side length of an equilateral triangle **Part C:** Define a function flagLine that takes 3 parameters and draws a line of flags (triangles). You MUST use the … | |
This 'sticky' thread is for working examples of Python GUI code. Note that most wxPython examples have their own thread. Please use comments in your code to help the reader. The example code should be usable as a template, so folks get a feel for the toolkit and can use … | |
Hey guys, I need some help with my code because I have a bit of trouble with changing the 12 hours time when I'm trying to change the strings in the object. When I try this: def GoLeft(self): if CurrentRow == 375: if self.channel_page >= 0: # Set the date … |
The End.