Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: format spec %b is documented but does not work
Post: RE: format spec %b is documented but does not work

I find this website to be very helpful: https://pyformat.info I hadn't heard about f-strings before, they seem very nice!
MTVDNA News and Discussions 13 10,618 Jul-28-2017, 09:02 AM
    Thread: Python Code Generator
Post: RE: Python Code Generator

Off the top of my head I think it should be: wells = i*replicates + j*replicates*N_cDNA + k + 1. I can't really test it right now though. I'll have some more time later, so I'll post an explanation t...
MTVDNA General Coding Help 11 8,907 Jul-27-2017, 10:04 AM
    Thread: Python Code Generator
Post: RE: Python Code Generator

I'm on mobile right now so I can't respond in as much detail. Take a look at your calculation. If i=0, the values should be 1,2,3,... If i=1, at what value should it start next? If you use wells = ...
MTVDNA General Coding Help 11 8,907 Jul-26-2017, 09:56 PM
    Thread: format spec %b is documented but does not work
Post: RE: format spec %b is documented but does not work

You must use the new format function: print("int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42))Output:int: 42; hex: 2a; oct: 52; bin: 101010from: https://docs.python.org/3/library/strin...
MTVDNA News and Discussions 13 10,618 Jul-26-2017, 04:46 AM
    Thread: Python Code Generator
Post: RE: Python Code Generator

I would use a dictionary, and make use of the modulo operator. Something like this: N_cols = 30 name2index = {"{}{}".format(chr(65 + int(a/12)), a%12 + 1):(a+1) for a in range(N_cols)} print(name2inde...
MTVDNA General Coding Help 11 8,907 Jul-25-2017, 09:54 PM
    Thread: CKEditor / Rin Editor
Post: RE: CKEditor

Maybe this works? Quote:There is a handy tool come by default with the bundle, which can be found at ckeditor/samples/toolbarconfigurator/index.html. It allows you to config the toolbar using GUI. ht...
MTVDNA Board 100 53,455 Jul-25-2017, 06:18 PM
    Thread: Python Code Generator
Post: RE: Python Code Generator

Well done!  The easiest way to achieve what you want is to just repeat the source in the cDNA_sources list. However that will give you a result like this: Output:Transfering          6ul from A1 to [...
MTVDNA General Coding Help 11 8,907 Jul-25-2017, 06:03 PM
    Thread: CKEditor / Rin Editor
Post: RE: CKEditor

Hmm, indeed the paste as plain text does work now, but not as I'd hoped. It apparently also removes all whitespace and linebreaks, so that's not very helpful.
MTVDNA Board 100 53,455 Jul-25-2017, 04:57 PM
    Thread: Python Code Generator
Post: RE: Python Code Generator

Next time please post your code between [ python ] tags (but without the spaces), that makes it a lot easier to read ;) In python indentation matters. Try this: for i in range(3):   # do some stuff  ...
MTVDNA General Coding Help 11 8,907 Jul-25-2017, 04:52 PM
    Thread: CKEditor / Rin Editor
Post: RE: CKEditor

I've played around with it a bit and I've come to the same conclusion. I just need to make sure to paste with ctrl+shift+v to paste as plain text, otherwise the formatting is copied too.  In the edito...
MTVDNA Board 100 53,455 Jul-25-2017, 04:11 PM
    Thread: CKEditor / Rin Editor
Post: RE: CKEditor

Looks like indents in code are indeed fixed, but unfortunately this doesn't work for output or errors yet. Code with preview0  1   2    3     4Output with 1 preview Output:0 1 2 3 4Error with 1 previ...
MTVDNA Board 100 53,455 Jul-25-2017, 03:42 PM
    Thread: Python Code Generator
Post: RE: Python Code Generator

Cool project! I wrote this example for you that 'transfers' mastermix to a series of wells as you wanted. Note that I used a dummy transfer function to generate some output. You'll need to adjust thi...
MTVDNA General Coding Help 11 8,907 Jul-24-2017, 10:00 PM
    Thread: indents disappearing from output after previewing post
Post: RE: indents disappearing from output after preview...

As far as I can tell no formatting is included (when I use view source in the editor). Pasting with ctrl + shift + v makes no difference either. Also, it seems that although only 1 space is removed ...
MTVDNA Board 14 8,329 Jul-24-2017, 01:11 AM
    Thread: Python socket progran
Post: RE: Python socket progran

There's a lot happening in these two lines of code: def get_protnumber(prefix):  return dict( (getattr(socket, a), a)    for a in dir(socket)      if a.startswith(prefix))Python interprets this as tw...
MTVDNA General Coding Help 1 2,968 Jul-24-2017, 12:59 AM
    Thread: Help with acroym creating
Post: RE: Help with acroym creating

You are on the right track! Let's split the problem up into smaller pieces. If you have a word, e.g. 'test', do you know how to get the corresponding letter (in this case 'T')?
MTVDNA General Coding Help 2 10,668 Jul-23-2017, 11:56 PM
    Thread: indents disappearing from output after previewing post
Post: RE: indents disappearing from output after preview...

I have noticed this same issue. As far as I know it happens every time. I copied my code from the console, I don't really see how the editor is relevant. (I used repl.it for some post I made here) Co...
MTVDNA Board 14 8,329 Jul-23-2017, 11:45 PM
    Thread: Numpy random number
Post: RE: Numpy random number

The difference is in the output: a2 returns an array of 4 floats, whereas a1 returns a 1x4 multidimensional array of floats, the first dimension in this case being 1. If you print the output you'll g...
MTVDNA Data Science 1 4,499 Jul-23-2017, 11:14 PM
    Thread: How to plot two list on the same graph with different colors?
Post: RE: How to plot two list on the same graph with di...

If you submit two arrays as arguments, it is assumed that they are x-coordinates and y-coordinates respectively. If you use only one array, these values will be used as y-coordinates and the x-coordin...
MTVDNA General Coding Help 2 28,811 Jul-18-2017, 12:57 AM
    Thread: Program exits with error, but can't discover which
Post: RE: Program exits with error, but can't discover w...

Well, I guess I can't rely on repl.it for this task. Too bad. I'll just run my simulations locally then. Thanks for your help!
MTVDNA Data Science 4 4,128 Jul-17-2017, 09:43 PM
    Thread: Program exits with error, but can't discover which
Post: RE: Program exits with error, but can't discover w...

Hey, I included my code in this post. You can run it here as well: repl.it/EwS1/555 For this project I'm using repl.it because I can easily share my code with someone else without him having to setu...
MTVDNA Data Science 4 4,128 Jul-17-2017, 06:41 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020