English 中文(简体)
你们为什么要放弃“11111”?
原标题:Why do you keep looping out "11111"?
Closed. This question needs details or clarity. It is not currently accepting answers.

aaa.py:

import subprocess

print(11111)
exp = 0
subprocess.run([ python ,  bbb.py ])

print(22222)
print(exp)

bbb.py

import aaa

print("hello world")
print("bbb.py :", aaa.exp)
aaa.exp += 1

为什么它继续陷入 lo?

问题回答

你们的履行使阿那.和贝.之间形成了一种循环依赖,导致一种无限的 lo。 让我们逐步结束所发生的事情:

1. aaa.py is executed.
2. import subprocess and print(11111) are executed.
3. exp is set to 0. subprocess.run([ python ,  bbb.py ]) runs bbb.py.

Now, in bbb.py:
4. import aaa tries to import aaa.py again.

这里的问题是:当香草进口甲时,它就在aa实施所有法典。 页: 1 由此形成了一种 lo,即甲草胺进口泡沫、乙.进口甲草胺和乙.,导致 lo。

How to fix this:

由于这两个方案都在获取和改变支出的价值,你可以把这个模块单独输入一个单元,并在阿阿那.py和b.py中进口。

expy

exp = 0

<>strong>aaaa.py

import subprocess
import exp

print(11111)
subprocess.run([ python ,  bbb.py ])
print(22222)
print(exp.exp)

bbb.py

import exp

print("hello world")
print("bbb.py :", exp.exp)
exp.exp += 1

<><>Output

11111
hello world
bbb.py : 0
22222
0




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签