Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Multiprocessing share variable
Post: Multiprocessing share variable
Hello!
I have the following problem :
Main.py:
import multiprocessing
import FilePlot
x = []
y = []
while True:
word = input()
if word == "plot":
multiprocessing.Process(target=FilePlot.runPlot).s... |
|
catosp |
General Coding Help |
0 |
2,148 |
Jul-15-2020, 10:45 AM |
|
|
Thread: name 'temperatures' not defined?
Post: RE: name 'temperatures' not defined?
try this:
def get_input():
input_list = list(
map(float, input("\nEnter the temperatures:").strip().split()))
return input_list
temperatures = get_input()
output_list = []
for i in ... |
|
catosp |
General Coding Help |
3 |
4,113 |
Jul-13-2020, 12:29 PM |
|
|
Thread: matplotlib multithreading
Post: matplotlib multithreading
Hello!
I have the following problem:
I cannot live plot in a different thread, the main window (plot window) is white with a rotating doughnut mouse pointer.
from matplotlib.figure import Figure
fro... |
|
catosp |
General Coding Help |
0 |
2,956 |
Jul-03-2020, 09:33 AM |
|
|
Thread: Alternative to dynamic variable names
Post: RE: Alternative to dynamic variable names
|
catosp |
General Coding Help |
13 |
4,602 |
Jun-20-2020, 03:45 PM |
|
|
Thread: Alternative to dynamic variable names
Post: RE: Alternative to dynamic variable names
Why your results are different from my results? What I am doing wrong? |
|
catosp |
General Coding Help |
13 |
4,602 |
Jun-20-2020, 03:22 PM |
|
|
Thread: Alternative to dynamic variable names
Post: RE: Alternative to dynamic variable names
From the performance point of view which method is faster: dictionary or vars()[]....?
I test the speed:
import time
my = {}
start_time = time.time()
my["clock"] = time
print(my["clock"].localtime()... |
|
catosp |
General Coding Help |
13 |
4,602 |
Jun-20-2020, 02:29 PM |
|
|
Thread: Alternative to dynamic variable names
Post: RE: Alternative to dynamic variable names
|
catosp |
General Coding Help |
13 |
4,602 |
Jun-20-2020, 01:02 PM |
|
|
Thread: Alternative to dynamic variable names
Post: RE: Alternative to dynamic variable names
(Jun-20-2020, 12:47 PM)Yoriz Wrote: my_dict = {}
rm = visa.ResourceManager()
my_dict["lakeshore"] = rm.open_resource('GPIB0::11::INSTR')
And in this case how acces its properties? Like:
lakeshore.wr... |
|
catosp |
General Coding Help |
13 |
4,602 |
Jun-20-2020, 12:54 PM |
|
|
Thread: Alternative to dynamic variable names
Post: RE: Alternative to dynamic variable names
(Jun-20-2020, 12:44 PM)Yoriz Wrote: Use a dictionary
I know how to use a dictionary but in this case, I have no idea how to do it. Because once I create the name of the instrument, then I need to ac... |
|
catosp |
General Coding Help |
13 |
4,602 |
Jun-20-2020, 12:46 PM |
|
|
Thread: Alternative to dynamic variable names
Post: Alternative to dynamic variable names
Hello !
This is a clasical example of pyvisa program:
import pyvisa
rm = pyvisa.ResourceManager()
rm.list_resources()
('ASRL1::INSTR', 'ASRL2::INSTR', 'GPIB0::12::INSTR')
inst = rm.open_resource('GPI... |
|
catosp |
General Coding Help |
13 |
4,602 |
Jun-20-2020, 12:36 PM |
|
|
Thread: Stopping a loop in another file
Post: RE: Stopping a loop in another file
(Jun-13-2020, 06:12 PM)Yoriz Wrote: Maybe this will suffice
File1.py:
import File2
while True:
a = input()
if a == "start":
File2.run_func = True
threading.Thread(target =... |
|
catosp |
General Coding Help |
4 |
2,690 |
Jun-15-2020, 02:45 PM |
|
|
Thread: Stopping a loop in another file
Post: RE: Stopping a loop in another file
|
catosp |
General Coding Help |
4 |
2,690 |
Jun-14-2020, 05:10 AM |
|
|
Thread: Stopping a loop in another file
Post: RE: Stopping a loop in another file
So, the run_func is a global variable in File2? And by writing File2.run_func can acces the global variable from that File2? |
|
catosp |
General Coding Help |
4 |
2,690 |
Jun-13-2020, 06:16 PM |
|
|
Thread: Stopping a loop in another file
Post: Stopping a loop in another file
Hello
File1.py:
import File2
while True:
a = input()
if a == "start":
threading.Thread(target = File2.func()).start()
if a == "stop":
#stop function File2.funcFile2.py:
d... |
|
catosp |
General Coding Help |
4 |
2,690 |
Jun-13-2020, 06:04 PM |
|
|
Thread: Modify Input() text
Post: RE: Modify Input() text
@Yoriz. Not exactly!
Let suppose that you want to write from keyboard in console for the input() the following text: I love hamburger. But you dont want to write the same string again and again, somet... |
|
catosp |
General Coding Help |
6 |
2,917 |
Jun-08-2020, 07:41 PM |
|
|
Thread: Modify Input() text
Post: RE: Modify Input() text
I want to use strText as predefined input text which can be modified from keyboard before hit enter and to pass it to variable a. |
|
catosp |
General Coding Help |
6 |
2,917 |
Jun-08-2020, 07:28 PM |
|
|
Thread: Modify Input() text
Post: Modify Input() text
Hello!
strText = "this is text 1"
a = input()+strText #or something like this
print(a)How can I make to appear strText as input text that can be modified? What I want is to modify some text in strText... |
|
catosp |
General Coding Help |
6 |
2,917 |
Jun-08-2020, 07:14 PM |
|
|
Thread: remove spaces with exceptions
Post: RE: remove spaces with exceptions
@buran and @pyzyx3qwerty
Thank you all !
I will use the @buran solution. |
|
catosp |
General Coding Help |
4 |
2,418 |
May-29-2020, 09:32 AM |
|
|
Thread: remove spaces with exceptions
Post: RE: remove spaces with exceptions
Ok, managed to write some piece of code to do the job:
word = "asdas asdd sd a2123 3234 \"test asd sdd 12 3231 123\" asda"
quo = False
wordT = ""
for letter in word:
if letter == "\"" ... |
|
catosp |
General Coding Help |
4 |
2,418 |
May-29-2020, 09:21 AM |
|
|
Thread: remove spaces with exceptions
Post: remove spaces with exceptions
Hello!
I have the following problem:
This is the string: asdas asdd sd a2123 3234 "test asd" asda
Is possible to remove all spaces except the spaces between "" ?
Thank you! |
|
catosp |
General Coding Help |
4 |
2,418 |
May-29-2020, 08:12 AM |